Skip to content Skip to sidebar Skip to footer

How To Return All The Columns With Flask-sqlalchemy Query Join From Two Tables

I'm trying to do a join from two tables in flask-sqlalchemy and I want all the columns from both tables but if I execute: Company.query.join(Buyer, Buyer.buyer_id == Company.id).al

Solution 1:

at the end I've achieved this by using this simple sqlalchemy query:

db.session.query(Company, Buyer).join(Buyer, Buyer.buyer_id == Company.id).all()

It returns:

(<Company2>, <Buyer1, 2>)

Post a Comment for "How To Return All The Columns With Flask-sqlalchemy Query Join From Two Tables"