django_sorcery.db.utils module

class django_sorcery.db.utils.dbdict[source]

Bases: dict

Holds all configured sqlalchemy.SQLAlchemy instances.

atomic(savepoint=True)[source]

Returns a context manager/decorator that guarantee atomic execution of a given block or function across all configured and initialized SQLAlchemy instances.

commit()[source]

Applies commit on all registered databases.

flush()[source]

Applies flush on all registered databases.

get(alias=None, cls=<class 'django_sorcery.db.sqlalchemy.SQLAlchemy'>, **kwargs)[source]

Returns a sqlalchemy.SQLAlchemy instance from configuration and registers it.

Can return a custom sqlalchemy.SQLAlchemy instance thru args or thru SQLALCHEMY database setting in configuration.

remove()[source]

Applies remove on all registered databases.

rollback()[source]

Applies rollback on all registered databases.

update([E, ]**F) → None. Update D from dict/iterable E and F.[source]

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

django_sorcery.db.utils.index_foreign_keys(*args)[source]

Generates indexes for all foreign keys for a table or metadata tables.