test case:

from sqlalchemy import *
db = create_engine( 'sqlite:///:memory:')
meta = BoundMetaData( db)

table_A = Table( 'A', meta,
  Column( 'name', type= String, ),
  Column( 'id', primary_key= True, type= Integer ),
  Column( 'atype', type= String, ),
)

table_B = Table( 'B', meta,
  Column( 'bdata', type= String, ),
  Column( 'id', Integer, ForeignKey( 'A.id', ), primary_key= True ),
)

selB = table_A.join( table_B).select( table_A.c.atype == 'B' )
print '---', selB

selselB = select( selB.columns)
print '===', selselB

:::::::::: results in: 

--- (SELECT "A".name AS name, "A".id AS id, "A".atype AS 
atype, "B".bdata AS bdata, "B".id AS id 
FROM "A" JOIN "B" ON "A".id = "B".id 
WHERE "A".atype = ?)

=== SELECT name, id, atype, bdata 
FROM (SELECT "A".name AS name, "A".id AS id, "A".atype AS 
atype, "B".bdata AS bdata, "B".id AS id 
FROM "A" JOIN "B" ON "A".id = "B".id 
WHERE "A".atype = ?)


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

Reply via email to