Disclaimer: Don't use this module in production it's still in active development.
Django Async Orm
Django module that brings async to django ORM.
Installing
python -m pip install django-async-orm
then add django_async_orm to your INSTALLED_APPS list:
INSTALLED_APPS = [
...,
'django_async_orm'
]
Usage
Django Async Orm will patch all your existing models to add async_* prefixed methods.
To be
example:
class MyModel(models.Model):
name = models.CharField(max_length=250)
you can use it as follow:
async def get_model():
return await MyModel.objects.async_get(name="something")
you can also iterate over a query set with async for:
async def all_models():
all_result_set = await MyModel.objects.async_all()
async for obj in all_result_set:
print(obj)
Some wrappers are also available for template rendering, form validation and login/logout
Async login
from django_async_orm.wrappers import async_login
async def my_async_view(request):
await async_login(request)
...
Form validation
from django_async_orm.wrappers import async_form_is_valid
async def a_view(request):
form = MyForm(request.POST)
is_valid_form = await async_form_is_valid(form)
if is_valid_form:
...
Django ORM support:
This is an on going projects, not all model methods are ported.
Manager:
| methods | supported | comments |
|---|---|---|
Model.objects.async_get |
✅ | |
Model.objects.async_create |
✅ | |
Model.objects.async_count |
✅ | |
Model.objects.async_none |
✅ | |
Model.objects.async_bulk_create |
✅ | |
Model.objects.async_bulk_update |
✅ | |
Model.objects.async_get_or_create |
✅ | |
Model.objects.async_update_or_create |
✅ | |
Model.objects.async_earliest |
✅ | |
Model.objects.async_latest |
✅ | |
Model.objects.async_first |
✅ | |
Model.objects.async_last |
✅ | |
Model.objects.async_in_bulk |
✅ | |
Model.objects.async_delete |
✅ | |
Model.objects.async_update |
✅ | |
Model.objects.async_exists |
✅ | |
Model.objects.async_explain |
✅ | |
Model.objects.async_raw |
✅ | |
Model.objects.async_all |
✅ | |
Model.objects.async_filter |
✅ | |
Model.objects.async_exclude |
✅ | |
Model.objects.async_complex_filter |
✅ | |
Model.objects.async_union |
✅ | |
Model.objects.async_intersection |
✅ | |
Model.objects.async_difference |
✅ | |
Model.objects.async_select_for_update |
✅ | |
Model.objects.async_prefetch_related |
✅ | |
Model.objects.async_annotate |
✅ | |
Model.objects.async_order_by |
✅ | |
Model.objects.async_distinct |
✅ | |
Model.objects.async_difference |
✅ | |
Model.objects.async_extra |
✅ | |
Model.objects.async_reverse |
✅ | |
Model.objects.async_defer |
✅ | |
Model.objects.async_only |
✅ | |
Model.objects.async_using |
✅ | |
Model.objects.async_resolve_expression |
✅ | |
Model.objects.async_ordered |
✅ | |
__aiter__ |
✅ | |
__repr__ |
✅ | |
__len__ |
✅ | |
__getitem__ |
✅ | |
Model.objects.async_iterator |
❌ |
RawQuerySet
Not supported ❌
You can still call Model.object.async_raw() but you will be unable to access the results.
Model:
| methods | supported | comments |
|---|---|---|
Model.async_save |
❌ | |
Model.async_update |
❌ | |
Model.async_delete |
❌ | |
... |
❌ |
User Model / Manager
| methods | supported | comments |
|---|---|---|
UserModel.is_authenticated |
✅ | |
UserModel.is_super_user |
✅ | |
UserModel.objects.async_create_user |
❌ | |
... |
❌ |
Foreign object lazy loading:
Not supported ❌
Wrappers:
| methods | supported | comments |
|---|---|---|
wrappers.async_render |
✅ | |
wrappers.async_login |
✅ | |
wrappers.async_logout |
✅ |
Metadata
Release files for django-async-orm 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-async-orm-0.1.12.tar.gz | 8.9 kB | Without provenance | Details for django-async-orm-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_async_orm-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for django_async_orm-0.1.12-py3-none-any.whl |
Total release size: 17.9 kB
Release files / django-async-orm-0.1.12.tar.gz
| Download URL | django-async-orm-0.1.12.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c97e2011eb1e0147473047a229047425e60eaf79f6b6ce37fdbc24f6371436e8
|
|
BLAKE2b-256 checksum How to use checksums |
0461758735273595625c143a02f67fea4e33bd0500894fe5b0c2835de9fb2b93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.5 Linux/6.2.4-060204-generic
|
Release files / django_async_orm-0.1.12-py3-none-any.whl
| Download URL | django_async_orm-0.1.12-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f23bade57f2764ffaac63dc248e145b6e5a91f59def13b0ca038183e360da4a
|
|
BLAKE2b-256 checksum How to use checksums |
85cddf12d7ee9a02a402c553c7936c5bb932672b5b3dd2c5f10d1b7b18543ad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.5 Linux/6.2.4-060204-generic
|
Security for django-async-orm 0.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.