Solutionunvalidated

you should be able to simplify that down using joins and avoids having subqueries — with Session(engine) as session. Outcome: final_query = session.query(TaskContent, User.username)\ .join( User, TaskContent.created_by == User.id )\ .join( CurrentTaskContent, CurrentTaskContent.identifier == TaskContent.identifier ).

089c2b80-e54d-44da-a4b9-28f27d848d67

you should be able to simplify that down using joins and avoids having subqueries — with Session(engine) as session. Outcome: final_query = session.query(TaskContent, User.username)
.join( User, TaskContent.created_by == User.id )
.join( CurrentTaskContent, CurrentTaskContent.identifier == TaskContent.identifier ).