I've created SQL query which excludes not active tournaments, but I still 
have no idea how to get a similar result by ORM where the list of 
user.member_of keeps only active tournament records...
select u.*, t.*
from "user" u
join playeroftournament pt on pt.user_id = u.id
join tournament t on pt.tournament_id = t.id
where u.id = '9e53da4b-f506-46b1-a3be-c091585d704c' and t.is_active = true;

This query produces results which include all tournaments 
session.query(db.User).join(db.Player, db.Player.user_id == db.User.id).join
(db.Tournament, db.Player.tournament_id == db.Tournament.id).filter
(db.Tournament.is_active == True, db.User.id == '
9e53da4b-f506-46b1-a3be-c091585d704c')

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/08f5c11a-93ce-40a6-abe4-0ec15e38a479%40googlegroups.com.

Reply via email to