A powerful async ORM, query builder, and admin GUI
Benefits
- Supports Postgres, SQLite and CockroachDB
- Async and sync support
- A builtin playground - which makes learning a breeze
- Tab completion support - works great with iPython and VSCode
- Batteries included - a User model, authentication, migrations, an admin, and more
- Modern Python - fully type annotated
- Built for web developers and data scientists
Examples
Select
>>> await Band.select(
... Band.name
... ).where(
... Band.popularity > 100
... )
[
{
'name': 'Pythonistas',
}
]
Join
>>> await Band.select(
... Band.name,
... Band.manager.name.as_alias('manager_name')
... )
[
{
'name': 'Pythonistas',
'manager_name': 'Guido'
},
...
]
Delete
await Band.delete().where(
(Band.band_members == 0) | (Band.manager.status == 'disabled')
)
Update
await Band.update({Band.members: 5}).where(
Band.name == 'Pythonistas'
)
Or, alternatively:
band = await Band.objects().get(Band.name == 'Pythonistas')
band.members = 5
await band.save()
Getting started
Read the docs, and learn the basics in 5 minutes.