The queryset iterator protocol uses three nested iterators in the default case: 1. sql.compiler.execute_sql() - Returns 100 rows at time (constants.GET_ITERATOR_CHUNK_SIZE) using cursor.fetchmany(). This part is responsible for
(self)
| 417 | return len(self._result_cache) |
| 418 | |
| 419 | def __iter__(self): |
| 420 | """ |
| 421 | The queryset iterator protocol uses three nested iterators in the |
| 422 | default case: |
| 423 | 1. sql.compiler.execute_sql() |
| 424 | - Returns 100 rows at time (constants.GET_ITERATOR_CHUNK_SIZE) |
| 425 | using cursor.fetchmany(). This part is responsible for |
| 426 | doing some column masking, and returning the rows in chunks. |
| 427 | 2. sql.compiler.results_iter() |
| 428 | - Returns one row at time. At this point the rows are still just |
| 429 | tuples. In some cases the return values are converted to |
| 430 | Python values at this location. |
| 431 | 3. self.iterator() |
| 432 | - Responsible for turning the rows into model objects. |
| 433 | """ |
| 434 | self._fetch_all() |
| 435 | return iter(self._result_cache) |
| 436 | |
| 437 | def __aiter__(self): |
| 438 | # Remember, __aiter__ itself is synchronous, it's the thing it returns |
no test coverage detected