Hi,

I have four tables that I would like to join algorithmically. Element with 
element_prop, elementprop with element_typeprop in one direction and element 
with element_type in the other. I would like to do this in one line as I am 
concerned about the number queries must be minimal given I am working in a 
gigantic database.


q=session.query(element).outerjoin(element_prop,element.element_id==element_prop.element_id).outerjoin(element_prop,element_type_prop.element_type_prop_id==element_prop.element_type_prop_id).outerjoin(element,element_type.element_type_id==element.element_type_id)

I replicate the format I'd use for native SQL. However, I come across aliasing 
issues: ERROR 1066 (42000): Not unique table/alias: 'element_prop'  when I run 
the generated SQL code, even though sqlalchemy doesn't prompt any error 
messages.

I would like to find out an efficient and robust way of joining these tables 
the way I described. What would be the best solution given my concerns?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to