Hello.
I'm just starting out with pisces.
I was given css3.0 flat files to import.
The site file ('1882.site') looks like:
AML 1994242 -1 42.1311 73.6941 3.4000 Almayashu, Kyrgyzstan ss AML 0.0000 0.0000 20020807 13:52:27
Following the doc examples, I tried to read it via:
import sqlalchemy as sa
import pisces.schema.css3 as css
class Site(css.Site):
__tablename__ = 'site'
with open('1882.site') as ffsite:
for line in ffsite:
isite = Site.from_string(line)
The problem is that the line has a load time (hh:mm:ss) as well as a load date (lddate), so the from_string conversion bombs.
I can hand edit the file, but I think this might be a recurring issue.
My questions are:
1. Where do I find the fixed-length fields description for each table ?
i.e, for the site table, I can look up the fields in oracle by doing SQL>desc static.site;
So I can see that LDDATE is of type 'DATE', but I imagine this can take many different formats.
2. Is there a way to override the flat file field descriptions, say to give it the actual DATE format for this case ?
3. More fundamental: I'm unclear on how the schemas are being used.
For instance, why is it necessary to define the Site class as above ?
I would've thought that the css3.0 schema is predefined and there would be a method already available to
generate an instance of a class(table), along with a method to populate the attributes via the flat file line ?
e.g., if instead of using flat files, I connect to an oracle db:
session = ps.db_connect(or_string)
Site, Affil = ps.get_tables(session.bind, ['static.site', 'static.affiliation'])
It returns a Site object without me having to subclass it.
Sorry for the questions, just want to understand how the API is meant to work.
Thanks!
-Mike