Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aioworkers/aioworkers-databases
aioworkers plugin for databases
https://github.com/aioworkers/aioworkers-databases
aioworkers-plugin asyncio mysql postgres python sqlalchemy sqlite
Last synced: 1 day ago
JSON representation
aioworkers plugin for databases
- Host: GitHub
- URL: https://github.com/aioworkers/aioworkers-databases
- Owner: aioworkers
- License: apache-2.0
- Created: 2021-03-15T11:01:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-05T10:38:06.000Z (over 3 years ago)
- Last Synced: 2024-08-09T06:53:23.051Z (3 months ago)
- Topics: aioworkers-plugin, asyncio, mysql, postgres, python, sqlalchemy, sqlite
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aioworkers-databases
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/aioworkers/aioworkers-databases/CI)](https://github.com/aioworkers/aioworkers-databases/actions?query=workflow%3ACI)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aioworkers-databases)](https://pypi.org/project/aioworkers-databases)
[![PyPI](https://img.shields.io/pypi/v/aioworkers-databases)](https://pypi.org/project/aioworkers-databases)aioworkers plugin for [databases](https://github.com/encode/databases).
## Usage
Add your database config to aioworkers `config.yaml`:
```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`:
```shell
aioworkers -c config.yaml -i
```Create `Context` for this config and use your db via context:
```python
await context.db.execute('CREATE TABLE some_table (id INT);')
```## Development
Install requirements:
```shell
poetry install
```Run tests:
```shell
pytest
```