MCPcopy
hub / github.com/django/django / results_iter

Method results_iter

django/db/models/sql/compiler.py:1564–1585  ·  view source on GitHub ↗

Return an iterator over the results from executing this query.

(
        self,
        results=None,
        tuple_expected=False,
        chunked_fetch=False,
        chunk_size=GET_ITERATOR_CHUNK_SIZE,
    )

Source from the content-addressed store, hash-verified

1562 yield row
1563
1564 def results_iter(
1565 self,
1566 results=None,
1567 tuple_expected=False,
1568 chunked_fetch=False,
1569 chunk_size=GET_ITERATOR_CHUNK_SIZE,
1570 ):
1571 """Return an iterator over the results from executing this query."""
1572 if results is None:
1573 results = self.execute_sql(
1574 MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size
1575 )
1576 fields = [s[0] for s in self.select[0 : self.col_count]]
1577 converters = self.get_converters(fields)
1578 rows = chain.from_iterable(results)
1579 if converters:
1580 rows = self.apply_converters(rows, converters)
1581 if self.has_composite_fields(fields):
1582 rows = self.composite_fields_to_tuples(rows, fields)
1583 if tuple_expected:
1584 rows = map(tuple, rows)
1585 return rows
1586
1587 def has_results(self):
1588 """

Callers 4

__iter__Method · 0.80
__iter__Method · 0.80
__iter__Method · 0.80
__iter__Method · 0.80

Calls 5

execute_sqlMethod · 0.95
get_convertersMethod · 0.95
apply_convertersMethod · 0.95
has_composite_fieldsMethod · 0.95

Tested by

no test coverage detected