I'm trying to determine whether or not there are any value in one
mapped object relation that correspond to another  mapped object
relation

i.e
A.x - represents a relation of x's on A
B.x - represents a relation of x's on B

They both use their own separate mapping tables for these relations.
So I want to find out of any of A.x is also present in B.x

The closes I've had to it working was in the follwing fashion, by
doing the following;

exists([1],from_obj=join(A_x_mapping_table,B_x_mapping_table,
 
onclause=A_x_mapping_table.c.id==B_x_mapping_table.c.id))

I put this exists clause into an existing filter() but it didn't
correlate the tables with those in the outer query (which I really
need it to do!), so I tried using correlate function to correlate the
table on the join() but it didn't seem to do anything (I've used it in
other situations with success but not this time).

Also ,  A.x.any(B.x.any())
 seems to almost do what I want as well, but again, doesn't correlate
to outer query and because I'm using 0.4 it does not have a
correlate() method in ORM!

Any other hints as to how I can do this ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to