sqlalchemy_dlock.lock.mssql module¶
- class sqlalchemy_dlock.lock.mssql.MssqlAsyncSadLock(connection_or_session, key, **kwargs)[source]¶
Bases:
MssqlSadLockMixin,BaseAsyncSadLock[str,AsyncConnection|AsyncSession|async_scoped_session]Async IO version of MssqlSadLock
- Parameters:
key (
Any) – SQL Server requires the resource name as a string (max 255 chars)convert – Custom function to convert key to string
shared –
shared- Whether to use Shared lock modeupdate –
update- Whether to use Update lock mode Note: Shared and Update are mutually exclusive. If both are True, Update takes precedence.connection_or_session (AsyncConnection | AsyncSession | async_scoped_session)
- class sqlalchemy_dlock.lock.mssql.MssqlSadLock(connection_or_session, key, **kwargs)[source]¶
Bases:
MssqlSadLockMixin,BaseSadLock[str,Connection|Session|scoped_session]Distributed lock implemented by SQL Server application lock (sp_getapplock)
- Parameters:
key (
Any) – SQL Server requires the resource name as a string (max 255 chars)convert – Custom function to convert key to string
shared –
shared- Whether to use Shared lock modeupdate –
update- Whether to use Update lock mode Note: Shared and Update are mutually exclusive. If both are True, Update takes precedence.connection_or_session (Connection | Session | scoped_session)
- class sqlalchemy_dlock.lock.mssql.MssqlSadLockMixin(*, key, convert=None, shared=False, update=False, **kwargs)[source]¶
Bases:
AbstractLockMixin[KTV,str]Mixin class for SQL Server application lock
- Parameters:
key (
TypeVar(KTV, bound=Any)) – SQL Server requires the resource name as a string (max 255 chars)convert (
Callable[[TypeVar(KTV, bound=Any)],str] |None) – Custom function to convert key to stringupdate (
bool) –update- Whether to use Update lock mode Note: Shared and Update are mutually exclusive. If both are True, Update takes precedence.
- MSSQL_LOCK_RESOURCE_MAX_LENGTH = 255¶
- property lock_mode: Literal['Shared', 'Update', 'Exclusive']¶
The lock mode being used (for informational purposes)
Is the lock mode Shared