Hello,
I have a question about SQLAlchemy (well, I have a lot of questions,
but I'll try to space them out a bit!). I'm very new to it (and
python) but not databases and ORMs.
I like that I can use reflection to define tables, and I really want
to use that since I don't want to update python classes when I modify
a table. I am defining my table like this:
metadata = MetaData()
metadata.bind = engine
platesTable = Table('plate', metadata, autoload=True)
Next, I want to map my plate table to a lookup table:
surveyTable = Table('survey', metadata)
x = sql.join(platesTable, surveyTable, platesTable.c.survey_pk ==
surveyTable.c.pk)
mapper(??plate class??, x, properties={'pk':[platesTable.c.survey_pk,
surveyTable.c.pk]})
The problem is that I don't know what to put in for the plate class
since I used reflection and haven't defined one. Does this mean that I
have to define the class by hand and can't have it done automatically?
Can the autoload figure these relationships out?
Thanks in advance for any help!
Cheers,
Demitri
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---