https://github.com/dymoo/pyasyncorm
Async ORM & query builder for Python
https://github.com/dymoo/pyasyncorm
Last synced: 22 days ago
JSON representation
Async ORM & query builder for Python
- Host: GitHub
- URL: https://github.com/dymoo/pyasyncorm
- Owner: dymoo
- License: mit
- Created: 2021-06-20T18:55:00.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-20T19:01:23.000Z (about 5 years ago)
- Last Synced: 2023-12-26T18:22:17.314Z (over 2 years ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyasyncorm
Async ORM for SQL databases with a focus on simplicity, stability and performance.
## Current database support
- PostgreSQL, via asyncpg connector.
## Example code
```python
import asyncio
from pyasyncorm.model import Model, Column
from pyasyncorm.connection import Connection
class User(Model):
id = Column('int', primary_key=True)
email = Column('text', unique=True)
password = Column('text')
async def main():
# Connect and make sure all our models are migrated.
conn = Connection()
await conn.connect('postgresql://')
await conn.migrate([ User ])
# Create user
await User(email='test@mail.com', password='securepassword123').save()
asyncio.run(main())
```