Re: [SQLObject] Additionnal datas on joins
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brad B. <br...@bb...> - 2003-07-28 15:36:00
|
On Mon, Jul 28, 2003 at 12:25:56PM -0300, Bruno Trevisan wrote: > Hi > > > Which -- by the way -- I need to be able to do *right* *now*. :) I'm > > +1 for me too. > > > willing to help on getting the tests that need to pass written, and > > writing the code that passes them once we, the users of SQLObject, > > decide what is the most natural way to express composition. > > > what about: > > class Foo(SQLObject): > foo = StringCol(dbName='foo') > bar = ForeignKey([IntCol(dbName='bar_id'), > IntCol(dbName='bar_idd')]) > > So this would make room for keys of type other than integer and allow us > to have a variable number of keys in the composite foreignKey. The problem is we're not talking about a column here; we're talking about how to say "use these two (or three, or N) columns as the primary key". It doesn't make sense to assign this to a single attribute (attributes map one-to-one with SQL table columns, unless you've added some normal Python properties to your class as well), but rather to use meta-fu to let SQLObject know what we mean. The semantics should be unified, of course, so that you'd use the same semantics for single-column keys as for multi-column keys. I see no harm in continuing to follow the rule as well that if no key is defined, an implicit ID column is generated (as long as it's documented, which it is). -- Brad Bollenbach BBnet.ca |