Hi all,

I'm struggling to get a join to work, as below:


[...]
#Table definitions
        table = Table('vends', MetaData(),
                      Column('mac', String(64), primary_key=True), 
                      Column('vendor', String(20) ),
                      Column('vendorLong', String(30) )

        table = Table('proxs', MetaData(),
                      Column('mac', String(64), primary_key=True),
                      Column('location', String(length=60)) )

.......

dbms="sqlite:///db.sql"
db = create_engine(dbms)
metadata = MetaData(db)
metadata.reflect()

proxs = metadata.tables['proxs']
vends = metadata.tables['vends']

s=select([proxs.c.mac]).outerjoin(vends, proxs.c.mac == vends.c.mac)

[...]

At this point the 's' is of type "<class 
'sqlalchemy.sql.expression.Join'>". The query looks correct if I print it 
out (and in fact executes if I paste it into my DB):

>>> print s
(SELECT proxs.mac AS mac 
FROM proxs) LEFT OUTER JOIN vends ON proxs.mac = vends.mac

But I'm unsure of how to execute the query. I see documentation mentioning 
applying the filter() or execute() function to the join object, but it has 
no such functions. My questions are then:

1. How can I execute this query?
2. How can I apply a filter to it? e.g. filter(proxs.c.mac == vends.c.mac)

Best wishes,
Glenn




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to