Stichwort SQLAlchemy: Wenn man das über `Table`-Objekte macht, also einfach nur um SQL per Hand schreiben zu vermeiden, könnte das so aussehen (ungetestet):
query = session.query(Ticket)
if not user.admin:
query = query.filter_by(author=user)
return query.all()
„Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.“ — Brian W. Kernighan