Skip to main content

Module for working with PostgreSQL via asyncpg

Project description

aioworkers-pg

PyPI - Python Version PyPI

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioworkers_pg-0.2.1a1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file aioworkers-pg-0.2.1a1.tar.gz.

File metadata

  • Download URL: aioworkers-pg-0.2.1a1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.3.0

File hashes

Hashes for aioworkers-pg-0.2.1a1.tar.gz
Algorithm Hash digest
SHA256 1f20d887c7521a6a6f1eff180bd6956f2c74875847a4210e87ca6da18cb79be2
MD5 5384bde375e6fcf2fe45642a183afd9a
BLAKE2b-256 9d5e2b200077dc23e9f8c7b3ccc79a604e62d2897776d94201de4fa887f99536

See more details on using hashes here.

File details

Details for the file aioworkers_pg-0.2.1a1-py3-none-any.whl.

File metadata

  • Download URL: aioworkers_pg-0.2.1a1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.3.0

File hashes

Hashes for aioworkers_pg-0.2.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1128aa0f1313998d086438ed5d62719d13004d97a91a831795ba27286eff0858
MD5 fb0291f8f3b90cd12499d3dc517d72ae
BLAKE2b-256 007acfc5a011a6868e95487a18ac113b71d69f24a245b9a4da80cb3d1be53a75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page