Switched to using MySQLdb rather than SQLAlchemy for querying