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

Method __iter__

django/db/models/query.py:227–245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

225 """
226
227 def __iter__(self):
228 queryset = self.queryset
229 query = queryset.query
230 compiler = query.get_compiler(queryset.db)
231
232 if query.selected:
233 names = list(query.selected)
234 else:
235 # extra(select=...) cols are always at the start of the row.
236 names = [
237 *query.extra_select,
238 *query.values_select,
239 *query.annotation_select,
240 ]
241 indexes = range(len(names))
242 for row in compiler.results_iter(
243 chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size
244 ):
245 yield {names[i]: row[i] for i in indexes}
246
247
248class ValuesListIterable(BaseIterable):

Callers

nothing calls this directly

Calls 2

get_compilerMethod · 0.80
results_iterMethod · 0.80

Tested by

no test coverage detected