Relative Content

Tag Archive for djangodjango-orm

Django: How to use CURSOR .. WITH HOLD in Django ORM

In Django orm we have queryset.iterator https://docs.djangoproject.com/en/5.0/ref/models/querysets/#iterator that uses under the hood Postgres cursor www.postgresql.org/docs/current/sql-declare.html in case we using Postgres as a database of course.
By default Django uses it with WITHOUT HOLD setting, which is default in Postgres, that why it is also default in Django.