Skip to content
Python ayncio context manager for interacting with Postgres advisory locks.
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.flake8 Update lock functionality. Aug 9, 2019
.gitignore Initial commit Jul 4, 2019
LICENSE Update lock functionality. Aug 9, 2019
README.md Update lock functionality. Aug 9, 2019
docker-compose.yml Initial commit Jul 4, 2019
env.sh Initial commit Jul 4, 2019
postgres.py Update lock functionality. Aug 9, 2019
requirements.txt Initial commit Jul 4, 2019
test_postgres.py

README.md

Getting Started

This repo provides an asyncio wrapper for using Postgres Advisory locks in your project.

To get stated run the test suite:

python3 -m venv ~/.virtualenv/advisory_locks
source ~/.virtualenv/advisory_locks
pip install -r requirements.txt
source env.sh
docker-compose up -d
python3 -m unittest test_postgres.py

Example:

from postgres import AdvisoryLock, DatabaseConfig

dbconfig = DatabaseConfig()

async with AdvisoryLock("gold_leader", dbconfig) as connection:
    # application code

For more information see the blog post.

You can’t perform that action at this time.