sql alchemy query table and include relationship

Solutions on MaxInterview for sql alchemy query table and include relationship by the best coders in the world

showing results for - "sql alchemy query table and include relationship"
Stefania
02 Sep 2017
1# joined-load the "orders" collection on "User"
2query(User).options(joinedload(User.orders))
3
4# joined-load Order.items and then Item.keywords
5query(Order).options(
6    joinedload(Order.items).joinedload(Item.keywords))
7
8# lazily load Order.items, but when Items are loaded,
9# joined-load the keywords collection
10query(Order).options(
11    lazyload(Order.items).joinedload(Item.keywords))