Skip to main content

Module for working with Postgres SQL via asyncpg

Project description

https://travis-ci.org/aioworkers/aioworkers-pg.svg?branch=master Python versions https://img.shields.io/pypi/v/aioworkers-pg.svg

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:

pipenv install --dev --skip-lock

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.1.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file aioworkers-pg-0.1.0.tar.gz.

File metadata

  • Download URL: aioworkers-pg-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for aioworkers-pg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6bbd5cf49eb9d898f922c29a9193a1a6edd29a79efba720bf19bcff78a606a4a
MD5 206f013d1a9066691ffa1cee4cca5fe6
BLAKE2b-256 af550481e9b2a395266c4d232b14e0e44c5ee6c86ff90d2b3b99953b98741088

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