On Friday 11 January 2008 13:58:34 Alexandre Conrad wrote:
> Hi,
>
> playing with inheritance, I figured out that an inherited mapped
> class passed to filter doesn't point to the correct table.
>
> I have 2 classes, Catalog and CatalogChannel(Catalog).
>
> Here is the syntax followed by the generated query:
>
>    query.filter(Catalog.c.id==CatalogChannel.c.id)
>    WHERE catalogs.id = catalogs.id
why u need such a query? 
that's exactly what (inheritance) join does, and automaticaly - 
just query( CatalogChannel).all() would give u the above query.

as of the relations, they are quite automatic BUT magic does not 
always work, so u have to explicitly specify some things manualy.

> Normaly, I would join(["A", "B"]) the tables between each other.
> But if a "channel" relation only exists on the CatalogChannel
> class, join("channel") wouldn't work as SA looks at superclass
> Catalog. I thought it would naturally find the relationship by
> looking at the polymorphic "type" column from Catalog, but it
> doesn't. Mike suggested we would need to extend the API with a new
> method like
> join_to_subclass() or so... Even though, I still think SA should
> figure out which relation I'm looking at...
i'm not sure i can follow u here... i do have tests about referencing 
to baseclas / subclasses, self or not, and they work ok. 
dbcook/tests/sa/ref_*.py for plain sa (160 combinations), and 
dbcook/tests/mapper/test_ABC_inh_ref_all.py (10000 combinations)
IMO u are missing some explicit argument

--~--~---------~--~----~------------~-------~--~----~
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