Chrome Extension

Join models or tables query Sqlalchemy

Joining tables query in Sqlalchemy can be written as below
#JOINING TABLE (User and Address)
self.session.query(
    User.id,
    User.first_name,
    User.last_name,
    Address.city,
    Address.State
).join(
    Address, User.id == Address.user_id
).filter(
    Address.city.like('new%'))
).all()
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?
0 Comments