This is a little tricky. My first response was going to be something like:
session.query(Tournament).outerjoin("players").filter(Player.user_id !=
user.id)
...but that's wrong because it will include tournaments that the user
played in, as long as another user also played in them.
I *think* something like this should work, but I haven't tested it:
session.query(Tournament).filter(~Tournament.players.any(Player.user_id
==
user.id))
See the docs at
https://docs.sqlalchemy.org/en/13/orm/tutorial.html#using-exists
(Note that we're filtering on Player.user_id, rather than User.id,
because it saves us having to join to the User table)
Hope that helps,
Simon