Using SQLAlchemy, I can query a bunch of files for their names and who created them:
>>> DBSession.query(Version.name, Version.created_by_id).filter(Version.id.in_(versions_list)).all()
[('file1', 1), ('file2', 2), ('file3', 3)]
The Version.created_by_id corresponds to the user ID. All users reside in a separate table:
>>> DBSession.query(User.id, User.name).all()
[(1, 'Abe'), (2, 'Cal'), (3, 'Dan')]
How can I, with one query, get this result back when I query my files?
[('file1', 'Abe'), ('file2', 'Cal'), ('file3', 'Dan')]