Flask-SQLAlchemy extended with an ActiveRecord model which provides flexible querying