# Django Async ORM

**URL:** <https://forum.djangoproject.com/t/django-async-orm/8036>\
**Category:** Show & Tell\
**Created:** [May 23, 2021, 2:38pm UTC](https://forum.djangoproject.com/t/django-async-orm/8036 "2021-05-23T14:38:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rednaks](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rednaks/32/4618_2.png) [@rednaks](https://forum.djangoproject.com/u/rednaks)\
**Post date:** [May 23, 2021, 2:38pm UTC](https://forum.djangoproject.com/t/django-async-orm/8036/1 "2021-05-23T14:38:03Z")

</div>

It’s been a while I’m writing wrappers for django orm features, but at some point I was really tired because it’s really ugly to have tons of imports like this :

```
from utils.wrappers import async_render, async_modelform_is_valid, \
    async_get_or_create_model, async_save_model_instance, async_user_is_authenticated, async_login, async_logout, \
    async_get_model, async_get_twitch_engine, async_add_event_subscription_to_twitch_account, \
    async_first_twitchaccount_set, async_delete_model_instance, async_get_config, async_user_is_superuser, async_all_event_subscriptions, async_queryset_to_list

from asgiref.sync import sync_to_async, async_to_sync

```

So what I decided to do is to write a Django module (app) that will patch all available models and add `async` capabilities. : [django-async-orm · PyPI](https://pypi.org/project/django-async-orm/)

The manager now have methods prefixed with `async_` I couldn’t decide to have a different manager or namespace. but after watching Andew’s Talk decided to follow the namespacing.

here is an example:

```
async def my_view(request):
    obj = await MyModel.objects.async_get(name='something')
    ...

```

I also added some wrappers for template rendering and form validation and iterating on `QuerySet`.

now there still a lot of work, for example anything related to methods from Models directly like `Model.save()` , `delete()` etc …

feel free to test it and create an [issue](https://github.com/rednaks/django-async-orm/issues), Django ORM is big and I certainly can’t cover all use cases.

---

<div class="post-metadata">

**Author:** ![allen-munsch](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/allen-munsch/32/1627_2.png) [@allen-munsch](https://forum.djangoproject.com/u/allen-munsch)\
**Post date:** [May 28, 2021, 8:56am UTC](https://forum.djangoproject.com/t/django-async-orm/8036/2 "2021-05-28T08:56:27Z")

</div>

Just wanted to link a related thread here : [Asynchronous ORM](https://forum.djangoproject.com/t/asynchronous-orm/5925)
