Session Management Options
- class falcon_sqla.manager.SessionOptions
Defines a set of configurable options for the session.
An instance of this class is exposed via
Manager.session_options.- session_cleanup
Session cleanup mode; one of the
SessionCleanupconstants. Defaults toCOMMIT_ON_SUCCESS.- Type:
- no_session_methods
HTTP methods that by default do not require a DB session. Defaults to
SessionOptions.NO_SESSION_METHODS.- Type:
frozenset
- safe_methods
HTTP methods that can use a read-only engine since they do no alter the state of the db. Defaults to
SessionOptions.SAFE_METHODS.- Type:
frozenset
- read_from_rw_engines
When True read operations are allowed from read-write engines. Only used if more than one engine is defined in the
Manager. Defaults toTrue.- Type:
bool
- write_to_rw_engines
When True write operations are allowed from read-write engines. Only used if more than one engine is defined in the
Manager. Defaults toTrue.- Type:
bool
- write_engine_if_flushing
When True a write engine is selected if the session is in flushing state. Only used if more than one engine is defined in the
Manager. Defaults toTrue.- Type:
bool
- sticky_binds
When
True, the same engine will be used for each database operation for the same request. WhenFalse, the engine will be chosen randomly from the ones with the required capabilities. Only used if more than one engine is defined in theManager. Defaults toFalse.- Type:
bool
- request_id_func
A callable object that returns an unique id for to each session. The returned object must be hashable. Only used when
SessionOptions.sticky_bindsisTrue. Defaults touuid.uuid4.- Type:
callable
- wrap_response_stream
When
True(default), and the response stream is set, it is wrapped with an instanceClosingStreamWrapperin order to postpone SQLAlchemy session commit & cleanup after the response has finished streaming.- Type:
bool
- NO_SESSION_METHODS = frozenset({'OPTIONS', 'TRACE'})
HTTP methods that by default do not require a DB session.
- SAFE_METHODS = frozenset({'GET', 'HEAD', 'OPTIONS', 'TRACE'})
HTTP methods that do not alter the server state. These methods are assumed to be fine with read-only replica engines.