An instance of query_class. Can be used to query the
database for instances of this model. NOTE: Requires setting
MyClass.query=QueryProperty(session) when session available.
See make_declarative_base() for automatic implementation.

Configuration for to_dict(). Do any necessary preprocessing
and return a set of string attributes which represent the fields which
should be returned when calling to_dict().

By default this model is refreshed if it’s __dict__ state is empty
and only the ORM descriptor fields are returned.

This is the property to override if you want to return more/less than
the default ORM descriptor fields.

Generally, we can usually rely on __dict__ as a representation of
model when it’s just been loaded from the database. In this case,
whatever values are present in __dict__ are the loaded values
from the database which include/exclude lazy attributes (columns and
relationships).

One issue to be aware of is that after a model has been committed (or
expired), __dict__ will be empty. This can be worked around by
calling refresh() which will reload the data from the database
using the default loader strategies.

These are the two main cases this default implementation will try to
cover. For anything more complex it would be best to override this
property or the to_dict() method itself.

All available search filter functions indexed by a
canonical name which will be referenced in advanced/simple search.
All filter functions should take a single value and return an
SQLAlchemy filter expression, i.e.,
{key:lambdavalue:Model.column_name.contains(value)}

Advanced search models search by named parameters.
Generally found on advanced search forms where each field maps to a
specific database field that will be queried against. If defined as
a list, each item should be a key from __search_filters__.
The matching __search_filters__ function will be used in
the query. If defined as a dict, it should have the same format as
__search_filters__.

Internal helper class returned by Query.paginate(). You can also
construct it from any other SQLAlchemy query object if you are working with
other libraries. Additionally it is possible to pass None as query
object in which case the prev and next will no longer work.

SQLAlchemy features an ORM event API but one thing that is lacking is a way to
register event handlers in a declarative way inside the Model’s class
definition. To bridge this gap, this module contains a collection of decorators
that enable this kind of functionality.

These are factory functions that return common filter operations as functions
which are then assigned to the model class’ search config attributes. These
functions are syntatic sugar to make it easier to define compatible search
functions. However, due to the fact that a model’s query class has to be
defined before the model and given that the model column attributes need to be
defined before using the search factories, there are two ways to use the search
factories on the query class:

Initialization of Manager accepts a config object, session
options, and an optional declarative base. If Model isn’t provided,
then a default one is generated using
alchy.model.make_declarative_base(). The declarative base model is
accessible at Model.

By default the session_options are:

{'query_cls':alchy.Query,'autocommit':False,'autoflush':True}

The default session_class is alchy.Session. If you want to
provide your own session class, then it’s suggested that you subclass
alchy.Session and pass it in via session_class. This way
your subclass will inherit the functionality of alchy.Session.