hi
in a class hierarcy A,B,C,...  
in order to get "all things that are instances of a subclass of A but 
not A itself", i used somequery().from-statement( subfilter). 
then i found select_from() which allows to do further joins/filter etc 
and now use that.
but it won't work for polymorphic queries with unions, e.g. concrete 
inheritance (pseudocode):

m = mapper(A, with_polymorphic = ('*', 
    polymunion( A:..., B:..., C:..., ... ), alias=pu_a)
    )
allsubs = ses.query(A).select_from( 
    polymunion( B:.., C:.. ), alias=psub_a) #same as above less A 
    )
this seems to do a vector product:

SELECT psub_a.*
FROM (SELECT "B".db_id AS db_id, "B".name AS name, "B"."dataB" 
AS "dataB", 'B' AS atype FROM "B") AS psub_a, 
(SELECT "A".db_id AS db_id, "A".name AS name, CAST(NULL AS 
VARCHAR(200)) AS "dataB", 'A' AS atype 
FROM "A" UNION ALL SELECT "B".db_id AS db_id, "B".name AS 
name, "B"."dataB" AS "dataB", 'B' AS atype 
FROM "B") AS pu_a
...

is this bug or?

and, is this the correct way to do this stuff? 
the other way i can imagine is 
ses.query(A).filter( A.type != 'Aidentity') - but isn't this more 
expensive?

svil

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