Module for working with PostgreSQL via asyncpg
Project description
aioworkers-pg
Asyncpg plugin for aioworkers
.
Usage
Add this to aioworkers config.yaml:
db:
cls: aioworkers_pg.base.Connector
dsn: postgresql:///test
You can get access to postgres anywhere via context:
await context.db.execute('CREATE TABLE users(id serial PRIMARY KEY, name text)')
await context.db.execute(users.insert().values(name='Bob'))
Storage
storage:
cls: aioworkers_pg.storage.RoStorage
dsn: postgresql:///test
table: mytable # optional instead custom sql
key: id
get: SELECT * FROM mytable WHERE id = :id # optional custom sql
format: dict # or row
Development
Install dev requirements:
poetry install --no-root
Run tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioworkers-pg-0.2.1a1.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for aioworkers_pg-0.2.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1128aa0f1313998d086438ed5d62719d13004d97a91a831795ba27286eff0858 |
|
MD5 | fb0291f8f3b90cd12499d3dc517d72ae |
|
BLAKE2b-256 | 007acfc5a011a6868e95487a18ac113b71d69f24a245b9a4da80cb3d1be53a75 |