correct query_class handling for Flask-SQLAlchemy models