Querying with joins in sql alchemy and avoiding select all

Viewed 10766

I would like to know wether there is a way to combine joining two tables, and retrieving the two entities only with their relevant columns.

I want to avoid doing a thing such select * after joining two tables and getting only column id from Table A and column address from table B. Working with python2.7 I heard of sqlalchemy feature called with_entities, but not sure how can it be mixed with this kind of join, lets work on this example from sqlalchemy tutorial:

u, a  = session.query(User, Address).\
                     filter(User.id==Address.user_id).\
                     filter(Address.email_address=='jack@google.com').\
                     first():
1 Answers
Related