Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codemation/aiopyql
A fast and easy-to-use asyncio ORM(Object-relational Mapper) for performing C.R.U.D. ops within RBDMS tables using python.
https://github.com/codemation/aiopyql
asyncio asyncio-orm database mysql orm orm-framework postgres python python3
Last synced: 18 days ago
JSON representation
A fast and easy-to-use asyncio ORM(Object-relational Mapper) for performing C.R.U.D. ops within RBDMS tables using python.
- Host: GitHub
- URL: https://github.com/codemation/aiopyql
- Owner: codemation
- License: mit
- Created: 2020-07-13T11:00:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-05T06:46:23.000Z (over 3 years ago)
- Last Synced: 2024-10-12T18:59:32.757Z (about 1 month ago)
- Topics: asyncio, asyncio-orm, database, mysql, orm, orm-framework, postgres, python, python3
- Language: Python
- Homepage: https://pypi.org/project/aiopyql/
- Size: 355 KB
- Stars: 34
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.MD
Awesome Lists containing this project
README
![](./images/logo.png)
#
A fast and easy-to-use asyncio ORM(Object-relational Mapper) for performing C.R.U.D. ops within RBDMS tables using python.[![Documentation Status](https://readthedocs.org/projects/aiopyql/badge/?version=latest)](https://aiopyql.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/aiopyql.svg)](https://pypi.org/project/aiopyql/)#
## Key Features
- asyncio ready
- database / table query cache
- SQL-like query syntax
- Automatic schema discovery / migrations#
## Documentation
[https://aiopyql.readthedocs.io/](https://aiopyql.readthedocs.io/)#
### Instalation
```bash
$ virtualenv -p python3.7 aiopyql-env$ source aiopyql-env/bin/activate
```
```bash
(aiopyql-env)$ pip install aiopyql
```
#
### Compatable Databases
- postgres - via [asyncpg](https://github.com/MagicStack/asyncpg)
- mysql - via [aiomysql](https://github.com/aio-libs/aiomysql)
- sqlite - via [aiosqlite](https://github.com/omnilib/aiosqlite)#
## Getting Started
```python
import asyncio
from aiopyql import dataasync def main():
#sqlite connection
sqlite_db = await data.Database.create(
database="testdb"
)
# create table
await db.create_table(
'keystore',
[
('key', str, 'UNIQUE NOT NULL'),
('value', str)
],
'key',
cache_enabled=True
)# insert
await db.tables['keystore'].insert(
key='foo',
value={'bar': 30}
)
# update
await db.tables['keystore'].update(
value={'bar': 31},
where={'key': 'foo'}
)# delete
await db.tables['keystore'].delete(
where={'key': 'foo'}
)
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
```
#
## Recipies
See other usage examples in [recipies](https://github.com/codemation/aiopyql/blob/master/recipies).
- [FastAPI](https://github.com/codemation/aiopyql/blob/master/recipies/fastapi_aiopyql.py)#
## Postgres```python
import asyncio
from aiopyql import dataasync def main():
mysql_db = await data.Database.create(
database='postgres_database',
user='postgres',
password='my-secret-pw',
host='localhost',
port=5432,
db_type='postgres'
)loop = asyncio.new_event_loop()
loop.run_until_complete(main())
```
#
## Mysql```python
import asyncio
from aiopyql import dataasync def main():
mysql_db = await data.Database.create(
database='mysql_database',
user='mysqluser',
password='my-secret-pw',
host='localhost',
port=3306,
db_type='mysql'
)loop = asyncio.new_event_loop()
loop.run_until_complete(main())
```
#
## Idea / Suggestion / Issue
- Submit an Issue
- Create a Pull request