More use of SQLAlchemy ORM and less traditional mysql queries.