Constants and Enums

class falcon_sqla.constants.EngineRole(value)

Engine role in Manager.

READ = 'r'

This engine is only suitable for reading (e.g., a read replica).

READ_WRITE = 'rw'

This engine is suitable for all types of queries.

When choosing, this engine will participate in balancing load in both READ and WRITE contexts (unless read_from_rw_engines is set to True).

WRITE = 'w'

This engine is only preferred for writing.

Note

A WRITE engine might still receive read queries when, for instance, these are issued from non-idempotent HTTP methods. This role should be seen as merely a hint that this engine should not be picked when a READ one is sufficient.

class falcon_sqla.constants.SessionCleanup(value)

Session cleanup behavior.

Sessions are automatically cleaned up and returned to the pool when using Manager's session_scope() or middleware. In addition to closing the session, to the mode-specific behavior is governed by the below constants.

Unless configured otherwise, the default behavior throughout this add-on is COMMIT_ON_SUCCESS.

Note

Customizable session cleanup complements SQLAlchemy’s “reset on return” behaviour, see also: https://docs.sqlalchemy.org/en/20/core/pooling.html#pool-reset-on-return.

CLOSE_ONLY = 'close'

Close only.

This mode only closes the session. Any commit or rollback should be performed explicitly in the code.

COMMIT = 'commit'

Always commit.

This mode always attempts to commit regardless of any exceptions raised.

Even if the commit attempt raises an exception, no rollback is performed.

COMMIT_ON_SUCCESS = 'default'

Commit on success (the default behavior).

This mode attempts to commit in the case there was no exception raised in the block in question (or in the case of middleware, request-response cycle), otherwise rollback.

In this mode, in the case the attempt to commit results in an exception itself, it is also followed up with a rollback.

ROLLBACK = 'rollback'

Rollback.

This mode always attempts to roll back regardless of any exceptions raised.