79575980

Date: 2025-04-15 20:23:49
Score: 0.5
Natty:
Report link

It should be the following query-generating code.

sender = aliased(User)
recipient = aliased(User)
query = (
    select(Message)
    .join(sender, Message.id_from == sender.id)
    .join(recipient, Message.id_to == recipient.id)
    .options(contains_eager(Message.sender.of_type(sender)),
             contains_eager(Message.recipient.of_type(recipient)))
    .order_by(direction(sender.id))
)

Found it here

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: aleks