aioworkers plugin for databases.
Add your database config to aioworkers config.yaml
:
db:
cls: aioworkers_databases.database.Database
dsn: sqlite:///db.sqlite
logging:
version: 1
disable_existing_loggers: false
root:
level: ERROR
handlers: [console]
handlers:
console:
level: DEBUG
class: logging.StreamHandler
loggers:
aioworkers_databases:
level: ERROR
handlers: [console]
propagate: true
Run aioworkers
:
aioworkers -c config.yaml -i
Create Context
for this config and use your db via context:
await context.db.execute('CREATE TABLE some_table (id INT);')
Install requirements:
poetry install
Run tests:
pytest