On 1/20/11 11:36 PM, Nathan Wright wrote:
As Mariano was saying, it might be possible save yourself some trouble
by using mappers directly instead of DeclarativeBase. You'd likely be
able to make your python objects easier to work with because they won't
be tied 1-to-1 to the schema that you're building on. This isn't about
defining relations so much as composing your mapped classes into their
most logical form. A single mapped class can span multiple tables or do
practically whatever else you want. YMMV but it's worth a look.

this! sqlalchemy is deliberately very flexible, and it allows you to have nice separation between your data model and your object model. you might pay a performance hit for this abstraction, of course, but in many (most?) cases it's an acceptable one.

sqlalchemy is the only ORM i've used with which i've never had to make any design compromises. i can put together my table structures and my object models separately, and then wire them up with mappers so they work as desired. and i've done some pretty weird stuff, where the attributes for a given class were actually dynamically generated by an attributes table, with a separate table storing the values of these attributes. i had to dig in pretty deeply (i had to implement my own "MappedCollection" subclass to handle some tricky relationships between my models), but it worked like a charm when i fully expected it to be impossible.

-r

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to