Thank you Michael for quick response.

On Tuesday, November 19, 2013 8:36:55 PM UTC-4, Michael Bayer wrote:
>
>
> On Nov 19, 2013, at 7:11 PM, askel <dumm...@mail.ru <javascript:>> wrote:
>
> Hello everybody,
>
> I have a question I couldn't find answer on my own so I'll greatly 
> appreciate if someone could give me an answer.
>
> Considering simple model https://gist.github.com/momyc/7554839, why would 
> query like the following work:
>
>     session.query(SourceA).join(SourceA.trans).filter(Trans.amount>0)
>
> while the following one fails to build join expression:
>
>     session.query(SourceA).join(Trans).filter(Trans.amount>0)
>
> I suspect that this is because there is not ForeignKey in 
> class/mapper/table declaration. Or, perhaps, I missed something in building 
> that relationship.
>
> It's not a show stopper and I can definitely live with that but knowing 
> why would bring harmony back to this world :)
>
>
> that would be correct, when you say query(A).join(B), the relationship() 
> construct isn’t used to resolve how to join those, only the ForeignKey that 
> exists between the two tables (if any).
>
> I suppose that’s something else that might be improved upon someday though 
> I’m sort of tapped on adding behavioral changes to 0.9….
>
>
>

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