Package Info

python-django-pglocks


PostgreSQL Advisory Locks for Django


Development/Languages/Python

django-pglocks provides a useful context manager to manage PostgreSQL advisory locks. It requires Django (tested with 1.5), PostgreSQL, and (probably) psycopg2.

Advisory locks are application-level locks that are acquired and released purely by the client of the database; PostgreSQL never acquires them on its own. They are very useful as a way of signalling to other sessions that a higher-level resource than a single row is in use, without having to lock an entire table or some other structure.

It's entirely up to the application to correctly acquire the right lock.

Advisory locks are either session locks or transaction locks. A session lock is held until the database session disconnects (or is reset); a transaction lock is held until the transaction terminates.

Currently, the context manager only creates session locks, as the behavior of a lock persisting after the context body has been exited is surprising, and there's no way of releasing a transaction-scope advisory lock except to exit the transaction.


License: MIT
URL: https://github.com/Xof/django-pglocks

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
1.0.4-bp156.4.1 info GA Release 2024-03-29 15 SP6
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python311-django-pglocks
1.0.4-bp155.2.14 info GA Release 2023-05-22 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python3-django-pglocks
1.0.4-bp154.1.23 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python3-django-pglocks
1.0.4-bp153.1.19 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python3-django-pglocks
1.0.4-bp152.1.4 info GA Release 2020-04-17 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • python3-django-pglocks