sqlalchemy_dlock.factory module¶
- sqlalchemy_dlock.factory.sadlock(connection_or_session: Union[sqlalchemy.engine.base.Connection, sqlalchemy.orm.session.Session, sqlalchemy.orm.scoping.scoped_session], key, **kwargs) sqlalchemy_dlock.sessionlevellock.AbstractSessionLevelLock ¶
Create a session level distributed lock object
- Parameters
connection_or_engine (sqlalchemy Connection or orm Session/ScoptedSession object.) – Database Connection on which the SQL locking functions will be invoked
key – Key/name or sth like that used as SQL locking function’s ID
- Returns
New created lock object, whose type is a sub-class of
AbstractSessionLevelLock
.The actual type of the lock object depends on the type of connection object.
MySQL and PostgreSQL are supported til now.
- Return type