jabajke

Untitled

May 30th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. latest_event = (
  2. select(event_table)
  3. .select_from(
  4. event_table
  5. .join(AccountEventAssociation)
  6. .join(account_table)
  7. )
  8. .where(AccountEventAssociation.c.account_id == account.id)
  9. .where(event_table.c.is_done == true())
  10. .order_by(event_table.c.end_time.desc())
  11. .limit(1)
  12. )
  13. stmt = (
  14. select(account_table)
  15. .select_from(account_table)
  16. .join(AccountEventAssociation)
  17. .join(
  18. latest_event.subquery(),
  19. latest_event.subquery().c.id == AccountEventAssociation.c.event_id
  20. )
  21. )
Advertisement
Add Comment
Please, Sign In to add comment