I wrote ✏️ 🎉 an article about Running Tasks Concurrently in Django Asynchronous Views  Buckle-up for our async-journey together! 🚗 #django #python #async

https://fly.io/blog/running-tasks-concurrently-in-django-asynchronous-views/

Running tasks concurrently in Django asynchronous views

Django is been getting more and more async abilities! Mariusz Felisiak explores how to run multiple async tasks in a Django asynchronous views.

Fly
@felixxm interesting article. 👍
Instead of "... perform a raw SQL statement" it would be better to create the query and extract SQL and params like this: 👇
```
query = get_user_model().objects.filter(email=email)
sql, params = qs.query.exists().sql_with_params()
cursor.execute(sql, params)
```
@paulox As a responsible maintainer 😇 I didn't want to recommend any undocumented hooks 🤫😉
@felixxm you're totally right. Let's document it 🙂
https://code.djangoproject.com/ticket/34636
#34636 (Add documentation for Query's function `sql_with_params`) – Django

@paulox TBH, I'm far from making it an official API🔥 We don't want to encourage using raw SQL quieres 🤷
@felixxm @paulox While I agree that that it can be useful it feels more like fixing the symptoms than the cause. Documenting it makes it part of the API contract, do we want that? I'd very much would think no.
@apollo13 @felixxm you both convinced me. But what's the issue to have a fully asynchronous database operation at least with Psycopg 3.1+ ?
@paulox @felixxm I am not sure what you mean with this question. I don't see a problem with psycopg's async support.

@apollo13 @felixxm I actually worded the sentence very badly. 😅

Mariusz showed in his article how you can make a fully asynchronous database query by manually creating an asynchronous connection and raw SQL statements. 👇
https://fly.io/django-beats/running-tasks-concurrently-in-django-asynchronous-views/#using-the-orm

It would be useful to make this possible directly in Django, at least when using PostgreSQL and Psycopg 3.1+ but I couldn't find an issue about it in the tracker, and I don't know if it doesn't exist or I couldn't find it. 🤷

Running tasks concurrently in Django asynchronous views

Django is been getting more and more async abilities! Mariusz Felisiak explores how to run multiple async tasks in a Django asynchronous views.

Fly
@paulox @felixxm probably doesn't exist. It is also not clear what the API would look like?