sqlalchemy_dlock.functions module

sqlalchemy_dlock.functions.create_sadlock(connection_or_session, key, *args, **kwargs)

Create a database distributed lock object

Parameters:
  • connection_or_session (Connection | Session | scoped_session) – Connection or Session object SQL locking functions will be invoked on it.

  • key – ID or name of the SQL locking function

Returns:

New created lock object.

Type of the lock object is sub-class of BaseSadLock, which depends on the passed-in SQLAlchemy connection or session.

MySQL and PostgreSQL connection/session are supported til now.

Return type:

BaseSadLock