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
Run postgres:
docker run --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test -d postgres
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.1a6.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file aioworkers-pg-0.2.1a6.tar.gz
.
File metadata
- Download URL: aioworkers-pg-0.2.1a6.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5699517b7bd9bd10c0a9b331183e0bf4021d92a66309d66410f5a7407d1a4856
|
|
MD5 |
81ebc06936290c7c6ae7a33b7d2a2d00
|
|
BLAKE2b-256 |
042ba68a8e225c4034194d1d93170929fdee512b522cd0eacc1d54a4e4f02f9b
|
File details
Details for the file aioworkers_pg-0.2.1a6-py3-none-any.whl
.
File metadata
- Download URL: aioworkers_pg-0.2.1a6-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ae27e9e6cbcbef7d7cfbc52bff16f38c53a3d4c6f6361881549e4d1eb3d11122
|
|
MD5 |
9a7b966ffb1ae71a6ce971d227d7cd56
|
|
BLAKE2b-256 |
7d03d86eec54d673cab6698e88865a54a53eb1bb9315d019eb410dfd3876bcdc
|