Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to use asyncpg with django? #1116

SilverFoxA started this conversation in General
Discussion options

I have been looking to implement async functionalities to my Django app to optimize the app performance. I'm looking for ways to use asyncpg in the Django app along with Django's built-in sync feature. I would greatly appreciate any suggestion.

You must be logged in to vote

Replies: 1 comment

Comment options

Currently, as per Django 5.0 release, Django ORM and most of Django itself is a synchronous framework where async functions are just sync functions wrapped into sync_to_async. I encourage you to check them out, as even for DB transactions I had to write a similar wrapper.
So even if it could be possible to use asyncpg as a driver via similar wrapper, it wouldn't be possible to gain any speed increase for it.

I don't mention that asyncpg doesn't follow DB-API and this would be challenge similarly as it was for SQLAlchemy few years ago.

With Django project philosophy to be as stable as possible and backward compatible as possible, I don't expect any async conversion any time soon.

If you're still looking for such integration, Django project itself would be a better place to ask.

PS: above findings were for me a strong enough reason to switch to another framework entirely.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /