Finally figured out how to properly use ORM

Constructing complex queries is not necessary, thanks to
sqlalchemy.ext.automap. Complex queries still need to be rewritten.