django_sorcery.db.utils module

class django_sorcery.db.utils.dbdict[source]

Bases: dict

Holds all configured sqlalchemy.SQLAlchemy instances.


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


Applies commit on all registered databases.


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.


Applies remove on all registered databases.


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]


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