MCPcopy
hub / github.com/django/django / __iter__

Method __iter__

django/db/models/sql/query.py:182–192  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

180 return [converter(column_meta[0]) for column_meta in self.cursor.description]
181
182 def __iter__(self):
183 # Always execute a new query for a new iterator.
184 # This could be optimized with a cache at the expense of RAM.
185 self._execute_query()
186 if not connections[self.using].features.can_use_chunked_reads:
187 # If the database can't use chunked reads we need to make sure we
188 # evaluate the entire query up front.
189 result = list(self.cursor)
190 else:
191 result = self.cursor
192 return iter(result)
193
194 def __repr__(self):
195 return "<%s: %s>" % (self.__class__.__name__, self)

Callers

nothing calls this directly

Calls 1

_execute_queryMethod · 0.95

Tested by

no test coverage detected