On Aug 27, 2012, at 5:16 PM, Jacob Biesinger wrote: > On Mon, Aug 27, 2012 at 4:57 PM, Michael Bayer <mike...@zzzcomputing.com> > wrote: > > On Aug 27, 2012, at 4:43 PM, Jacob Biesinger wrote: > >> >> Is the use case of having nested collections really all that out of >> mainstream? > > I would think just about any non-trivial application winds up having "nested > collections". In relational databases this just means you have one-to-many > relationships chained along. relationship() is the SQLAlchemy mechanism to > achieve one-to-many. This is like the most prominent feature in the whole > ORM so I'm not sure what's causing it to appear "non mainstream". > > If you're getting at the idea of having two or three big tables that > generically handle all kinds of lists and dictionaries from all over the rest > of the schema, yes, I'd characterize it as common, but not necessarily a best > practice in most cases. It doesn't scale very well as those two or three > giant tables grow to be huge, a single point of contention, hard to index and > manipulate. Nevertheless we support this architecture through such notions > as the "polymorphic association", which you'll find in the examples with the > distribution. > > Yes, this is the pattern I'm trying to describe though I've been thinking of > these as "typed collections", smallish tables for handling a particular > table's collections needs, which are all of a single type (so rows are either > a collection or a FK to ONE other table). It feels very doable, given the > many examples I've seen that don't go quite this far. If it's a common > enough use case, why not have an example on the best way to do this?
Uh, scroll up, I said, "which you'll find in the **examples** with the distribution". start reading here: http://docs.sqlalchemy.org/en/rel_0_7/orm/examples.html#examples-generic-associations -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.