On Sun, Aug 19, 2012 at 06:28:57PM -0700, Chris Travers wrote: > In DB2 this might be done like: > > SELECT * FROM address WHERE address->country->short_name = 'US'; > > I like DB2's approach better because there is no ambiguity between > namespace resolution but I don't entirely like the way the refs work as > separate from standard foreign keys. I'm not sure I have an opinion on pushing ORM features to the database layer, SQLAlchemy is doing a pretty good job for me already. I just wanted to say that in the beginning I didn't understand SQLAchemy's separation between foreign keys and relationships, but I have since come to understand that a "relationship" is a far more general concept than a foreign key. There are many kinds of relationships between entities in a database that can't be represented by a foreign key, but can be by a general join condition. A simple example might be "items in an order" which you could derive from a foreign key, compared to "items in an order which have sales tax" which is something more general. So whatever the result of this discussion, don't just consider foreign keys, think bigger. Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > He who writes carelessly confesses thereby at the very outset that he does > not attach much importance to his own thoughts. -- Arthur Schopenhauer
Attachment:
signature.asc
Description: Digital signature