Reader small image

You're reading from  Django in Production

Product typeBook
Published inApr 2024
Reading LevelIntermediate
PublisherPackt
ISBN-139781804610480
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Arghya Saha
Arghya Saha
author image
Arghya Saha

Arghya (argo) Saha, is a software developer with 8+ years of experience and has been working with Django since 2015. Apart from Django, he is proficient in JavaScript, ReactJS, Node.js, Postgres, AWS, and several other technologies. He has worked with multiple start-ups, such as Postman and HealthifyMe, among others, to build applications at scale. He currently works at Abnormal Security as a senior Site Reliability Engineer to explore his passion in the infrastructure domain. In his spare time, he writes tech blogs. He is also an adventurous person who has done multiple Himalayan treks and is an endurance athlete with multiple marathons and triathlons under his belt.
Read more about Arghya Saha

Right arrow

Exploring Django Async ORM

Django Async ORM was introduced in Django 4.1 to help developers take advantage of native support of asynchronous behavior in Python. When we use asynchronous Views or code in Django, we cannot use the native synchronous ORM. Using synchronous Django ORM would mean we are calling blocking synchronous code from asynchronous code, which will block the event loop. Django has a way to stop this, and we’ll see a SynchronousOnlyOperation error thrown by Django during such an operation.

Read more

If you are not familiar with async-await support in Python, please check out the official documentation to understand how Python natively supports async-await: https://docs.python.org/3/library/asyncio-task.html.

We should use Django Async ORM with Django Async view/code. The asynchronous query API would give the same response as the original synchronous Django ORM query API. The only difference is how we write the syntax of the query.

For example, let...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Django in Production
Published in: Apr 2024Publisher: PacktISBN-13: 9781804610480

Author (1)

author image
Arghya Saha

Arghya (argo) Saha, is a software developer with 8+ years of experience and has been working with Django since 2015. Apart from Django, he is proficient in JavaScript, ReactJS, Node.js, Postgres, AWS, and several other technologies. He has worked with multiple start-ups, such as Postman and HealthifyMe, among others, to build applications at scale. He currently works at Abnormal Security as a senior Site Reliability Engineer to explore his passion in the infrastructure domain. In his spare time, he writes tech blogs. He is also an adventurous person who has done multiple Himalayan treks and is an endurance athlete with multiple marathons and triathlons under his belt.
Read more about Arghya Saha