Nested query of sqlalchemy

for a correct sql nested query statement:

select * from flight where flight_num=any(select flight_num from ticket where user_email = "1234@qq.com")

how to write his sqlalchemy statement
my intention is: when a user takes a plane, there will be a record after buying a ticket-- there is a foreign key flight_num on the ticket ticket, ticket and the user"s user_email,. I want to log in by the user and query all the flight information according to the ticket owned by the user, that is, through the flight_num in ticket to query the list of aircraft details

.
Nov.03,2021

is about:

q = session.query(Ticket.flight_num).filter(Ticket.user_email == 'xxx@xxx.com')
r = session.query(Flight).filter(Flight.flight_num.in_(q))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c24e21-33705.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c24e21-33705.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?