> limited to non_primary mapper ? creating relationships with > non_primary mapper is a bad idea. the "foreignkey" error really > means, "cant find a foreignkey *that I recognize as part of the > parent or child tables*". hmmm. u mean, making the non-primary mapper equivalent (relation-wise) to the main mapper is no good? i don't use it for saving any data, only for fetching. okay, i'll try piping the select through main-mapper...
> On Jan 23, 2007, at 12:43 PM, svilen wrote: > > while on polymorphic-union mappers vs non-polymorphic.. > > > > i have 3 kinds of type-queries: query_ALL-instances, > > quiery_BASE-instances, quiery_SUB-instances. > > > > First gives me all instances of a class or subclasess thereof, > > and is matching the main polymorphic-union mapper. The 3rd is a > > .select( table.c.typecolumn != base-type), piped through that > > too. > > > > For the 2nd one - getting the direct instances only (no > > subclasses) - i have a choice: > > a) have another non-primary mapper with some select( > > table.c.typecolumn==class_discriminator) as a table > > b) pipe this same select through the the main mapper > > > > So far i'm going the first way, but i'm not sure which one is > > better. Can u give any suggestion? If there are no big penalties > > for b), i will prefer that one; building another mapper was a > > tricky thing - and it does not work right now, for rev 2233. e.g. > > > > For a very simple case, B inh A, A points to self: > > > > ArgumentError: Cant determine relation direction for 'linkA' on > > mapper 'Mapper|A|bz4A|non-primary' with primary join '"bz4A". > > "linkA_id" = "A".db_id' - foreign key columns are present in both > > the parent and the child's mapped tables. Specify 'foreign > > key' argument. > > > > Although the foreignkey _is_ there. i rmember this same error > > hapened before on some other occasion and then it disappeared. > > > > Anyway, if b) will work, i'll abandon it and not debug it to find > > why it breaks - unless you want it found and fixed. > > > > ciao > > svil > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" 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/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
