summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJohn Parton <john.parton.iv@gmail.com>2023-07-27 16:38:12 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-07-31 21:17:36 +0200
commitfff14736f1cc594f79ea0e2656b8375d837b7aca (patch)
treede93069e1230d4089b73bfe019ac5ab3e185bea7 /docs
parent1ad7761ee616341295f36c80f78b86ff79d5b513 (diff)
Fixed #34331 -- Added QuerySet.aiterator() support for prefetch_related().
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt13
-rw-r--r--docs/releases/5.0.txt6
2 files changed, 16 insertions, 3 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 92cf3baaec..8a9733786a 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -2579,10 +2579,10 @@ evaluated will force it to evaluate again, repeating the query.
long as ``chunk_size`` is given. Larger values will necessitate fewer queries
to accomplish the prefetching at the cost of greater memory usage.
-.. note::
+.. versionchanged:: 5.0
- ``aiterator()`` is *not* compatible with previous calls to
- ``prefetch_related()``.
+ Support for ``aiterator()`` with previous calls to ``prefetch_related()``
+ was added.
On some databases (e.g. Oracle, `SQLite
<https://www.sqlite.org/limits.html#max_variable_number>`_), the maximum number
@@ -4073,6 +4073,9 @@ attribute:
------------------------------
.. function:: prefetch_related_objects(model_instances, *related_lookups)
+.. function:: aprefetch_related_objects(model_instances, *related_lookups)
+
+*Asynchronous version*: ``aprefetch_related_objects()``
Prefetches the given lookups on an iterable of model instances. This is useful
in code that receives a list of model instances as opposed to a ``QuerySet``;
@@ -4091,6 +4094,10 @@ When using multiple databases with ``prefetch_related_objects``, the prefetch
query will use the database associated with the model instance. This can be
overridden by using a custom queryset in a related lookup.
+.. versionchanged:: 5.0
+
+ ``aprefetch_related_objects()`` function was added.
+
``FilteredRelation()`` objects
------------------------------
diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt
index e7fcc6e07f..cceba667f9 100644
--- a/docs/releases/5.0.txt
+++ b/docs/releases/5.0.txt
@@ -368,6 +368,12 @@ Models
:func:`~django.shortcuts.aget_list_or_404` asynchronous shortcuts allow
asynchronous getting objects.
+* The new :func:`~django.db.models.aprefetch_related_objects` function allows
+ asynchronous prefetching of model instances.
+
+* :meth:`.QuerySet.aiterator` now supports previous calls to
+ ``prefetch_related()``.
+
Pagination
~~~~~~~~~~