Metadata-Version: 2.1
Name: aioworkers-pg
Version: 0.2.1a1
Summary: Module for working with PostgreSQL via asyncpg
Home-page: https://github.com/aioworkers/aioworkers-pg
License: Apache Software License 2.0
Author: Alexander Bogushov
Author-email: abogushov@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: aioworkers (>=0.15)
Requires-Dist: asyncpgsa
Project-URL: Repository, https://github.com/aioworkers/aioworkers-pg
Description-Content-Type: text/markdown

# aioworkers-pg

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aioworkers-pg)
![PyPI](https://img.shields.io/pypi/v/aioworkers-pg)

Asyncpg plugin for `aioworkers`.


## Usage

Add this to aioworkers config.yaml:

```yaml
db:
  cls: aioworkers_pg.base.Connector
  dsn: postgresql:///test
```

You can get access to postgres anywhere via context:

```python
await context.db.execute('CREATE TABLE users(id serial PRIMARY KEY, name text)')
await context.db.execute(users.insert().values(name='Bob'))
```


## Storage

```yaml
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:

```shell
poetry install --no-root
```

Run tests:

```shell
pytest
```

