On Jan 13, 2008, at 1:02 PM, Alexandre Conrad wrote:

>
> Okay, okay Mike and Svilen. Of course ! I was thinking we could figure
> out that if a media being attached to a Catalog of type "channel",  
> thus
> a CatalogChannel polymorphically speaking, would figure out that
> Media.query.join(["catalog", "channel"]) would automaticly join to the
> "channel" attribute of CatalogChannel. But of course, at this point
> we're still building up the query and are not on the ORM part. So we
> need to explicitly join tables between each other. Got it.
>
> Anyway, my inital issue according to the subject's title, is that:
>
>   .filter(Catalog.c.id==CatalogChannel.c.id)
>
> generates the SQL query
>
>   "catalogs.id = catalogs.id"
>
> rather than the expected
>
>   "catalogs.id = catalog_channels.id"
>
> which
>
>   .filter(Catalog.c.id==catalog_channel_table.c.id)
>
> generates correctly when explcitly pointing the wanted table. Is  
> that a
> bug Mike ?
>

i dont really think it is.  the "c" collection is deprecated anyway;  
the "id" attribute on Catalog and all of its subclasses refers to the  
base "id" column on the catalog table; the other "foreign key"  
versions of that primary key are factored out when the mapper  
compiles.  that the "id" gets shoved into "c" is an implementation  
artifact, but is also why "c" is deprecated.  since the join youre  
doing intends to break through the abstraction of the polymorphic  
mapping, using the literal tables is the appropriate thing to do here,  
barring the existence of a new feature that would make what you're  
trying to do easier (which we should probably add).





--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to