summaryrefslogtreecommitdiff
path: root/docs/releases/4.1.txt
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2021-09-08 17:01:53 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-26 20:25:23 +0200
commit58b27e0dbb3d31ca1438790870b2b51ecdb10500 (patch)
tree04350501dde491cd1942cc08319e6b0dbddb6c72 /docs/releases/4.1.txt
parent27aa7035f57f0db30b6632e4274e18b430906799 (diff)
Fixed #33646 -- Added async-compatible interface to QuerySet.
Thanks Simon Charette for reviews. Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'docs/releases/4.1.txt')
-rw-r--r--docs/releases/4.1.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/releases/4.1.txt b/docs/releases/4.1.txt
index 0de527447b..b564a325a9 100644
--- a/docs/releases/4.1.txt
+++ b/docs/releases/4.1.txt
@@ -43,6 +43,28 @@ View subclasses may now define async HTTP method handlers::
See :ref:`async-class-based-views` for more details.
+Asynchronous ORM interface
+--------------------------
+
+``QuerySet`` now provides an asynchronous interface for all data access
+operations. These are named as-per the existing synchronous operations but with
+an ``a`` prefix, for example ``acreate()``, ``aget()``, and so on.
+
+The new interface allows you to write asynchronous code without needing to wrap
+ORM operations in ``sync_to_async()``::
+
+ async for author in Author.objects.filter(name__startswith="A"):
+ book = await author.books.afirst()
+
+Note that, at this stage, the underlying database operations remain
+synchronous, with contributions ongoing to push asynchronous support down into
+the SQL compiler, and integrate asynchronous database drivers. The new
+asynchronous queryset interface currently encapsulates the necessary
+``sync_to_async()`` operations for you, and will allow your code to take
+advantage of developments in the ORM's asynchronous support as it evolves.
+
+See :ref:`async-queries` for details and limitations.
+
.. _csrf-cookie-masked-usage:
``CSRF_COOKIE_MASKED`` setting