Hi all,
I have the following union query:

q1 = db.session.query(label('sid',distinct(left.c.patient_sid)))
q2 = db.session.query(label('sid',distinct(right.c.patient_sid)))
query = q1.union_all(q2)

Which works just fine.

And I have the following query to which I would like to join this:

intersect = db.session.query(label('sid', distinct(other.c.patient_sid)))
q = intersect.join(query, query.c.sid, intersect.c.sid)

But, alas, I keep getting: 
AttributeError: 'Query' object has no attribute 'c' (print query.c.sid 
gives the same thing and other.c.patient_sid gives an object value)

How can I join the union to the intersect query? I would use the intersect 
method, but MySQL sadly does not offer this easy out.

I tried union_all as a selectable, but I need to pass these query objects 
around and do some conditional logic on them and this caused a ton of 
problems

Thanks very much!

Greg--


-- 
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/d/optout.

Reply via email to