5 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: references to polymo...| From | Sent On | Attachments |
|---|---|---|
| svilen | 21 Feb 2007 07:05 | |
| Michael Bayer | 21 Feb 2007 07:54 | |
| sdob...@sistechnology.com | 21 Feb 2007 12:01 | |
| Michael Bayer | 21 Feb 2007 15:15 | |
| svilen | 22 Feb 2007 03:15 |
| Subject: | [sqlalchemy] Re: references to polymorphic concrete-inheritance![]() |
|---|---|
| From: | sdob...@sistechnology.com (sdob...@sistechnology.com) |
| Date: | 02/21/2007 12:01:57 PM |
| List: | com.googlegroups.sqlalchemy |
id use an association table with its own entity to make things easy.
hm, u mean... A.link references that table by single id, and the table contains the tuple (discriminator,id) ? But isn't this another sort of table-inheritance? looks like a join to me... not that i'm big specialist on joins. And how to automate the secondary loadby(discriminator,id)?
On Feb 21, 2007, at 10:05 AM, svilen wrote:
g'day.
How one can make such thing as a reference to concrete-inherited polymorphic mapper? e.g. if there are just two, A and B, B inherits A, both have full concrete tables. A has polymorphic mapper.
If both tables have separate primary ids, they will overlap as values - table_A.id=1 for some A() and table_B.id=1 for some B() are both ok; hence, query(A).getby_id(1) would return 2 objects via the polymorphic union. in this case, the unique key within the polymunion seems to be the id+type_discriminator; where type_discriminator effectively means "this id is from that table".
i see 2 possibilities here:
- use 2-field key: a tuple of discriminator(table_name) and id-in-that-table. How would one make references to those objects then? e.g. what would be the definition of Column( 'mylink_id', ...) be ? it becomes a link to multiple tables... Would the propertyLoaders support such multi-column key? or make some constructed single key instead?
- use one common sequence for filling both primary-keys of both tables. But this is limited to DBs which support sequences...
Any help?
ciao svil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




