sqlalchemy_dlock.functions module

sqlalchemy_dlock.functions.create_sadlock(connection_or_session: Connection | Session | scoped_session, key, *args, **kwargs) BaseSadLock

Create a database distributed lock object

Parameters:
  • connection_or_session – sqlalchemy Connection or orm Session/ScopedSession 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 subclass of BaseSadLock.

The actual type of the lock object depends on the type of connection object.

MySQL and PostgreSQL are supported til now.

Return type:

BaseSadLock