class ChunkedIteratorResult(IteratorResult):
An .IteratorResult
that works from an iterator-producing callable.
The given chunks argument is a function that is given a number of rows to return in each chunk, or None for all rows. The function should then return an un-consumed iterator of lists, each list of the requested size.
The function can be called at any time again, in which case it should continue from the same result set but adjust the chunk size as given.
Method | __init__ |
Undocumented |
Method | _fetchmany_impl |
Undocumented |
Method | _soft_close |
Undocumented |
Method | yield_per |
Configure the row-fetching strategy to fetch num rows at a time. |
Instance Variable | _metadata |
Undocumented |
Instance Variable | _source_supports_scalars |
Undocumented |
Instance Variable | _yield_per |
Undocumented |
Instance Variable | chunks |
Undocumented |
Instance Variable | dynamic_yield_per |
Undocumented |
Instance Variable | iterator |
Undocumented |
Instance Variable | raw |
Undocumented |
Inherited from IteratorResult
:
Method | _fetchall_impl |
Undocumented |
Method | _fetchiter_impl |
Undocumented |
Method | _fetchone_impl |
Undocumented |
Method | _raise_hard_closed |
Undocumented |
Method | _raw_row_iterator |
Return a safe iterator that yields raw row data. |
Instance Variable | _hard_closed |
Undocumented |
Inherited from Result
(via IteratorResult
):
Method | __iter__ |
Undocumented |
Method | __next__ |
Undocumented |
Method | _getter |
return a callable that will retrieve the given key from a .Row . |
Method | _tuple_getter |
return a callable that will retrieve the given keys from a .Row . |
Method | all |
Return all rows in a list. |
Method | close |
close this _result.Result . |
Method | columns |
Establish the columns that should be returned in each row. |
Method | fetchall |
A synonym for the _engine.Result.all method. |
Method | fetchmany |
Fetch many rows. |
Method | fetchone |
Fetch one row. |
Method | first |
Fetch the first row or None if no row is present. |
Method | freeze |
Return a callable object that will produce copies of this .Result when invoked. |
Method | mappings |
Apply a mappings filter to returned rows, returning an instance of _result.MappingResult . |
Method | merge |
Merge this .Result with other compatible result objects. |
Method | next |
Undocumented |
Method | one |
Return exactly one row or raise an exception. |
Method | one_or_none |
Return at most one result or raise an exception. |
Method | partitions |
Iterate through sub-lists of rows of the size given. |
Method | scalar |
Fetch the first column of the first row, and close the result set. |
Method | scalar_one |
Return exactly one scalar result or raise an exception. |
Method | scalar_one_or_none |
Return exactly one or no scalar result. |
Method | scalars |
Return a _result.ScalarResult filtering object which will return single elements rather than _row.Row objects. |
Method | unique |
Apply unique filtering to the objects returned by this _engine.Result . |
Class Variable | _attributes |
Undocumented |
Class Variable | _row_logging_fn |
Undocumented |
Instance Variable | _unique_filter_state |
Undocumented |
Inherited from _WithKeys
(via IteratorResult
, Result
):
Method | keys |
Return an iterable view which yields the string keys that would be represented by each .Row . |
Inherited from ResultInternal
(via IteratorResult
, Result
):
Method | _allrows |
Undocumented |
Method | _column_slices |
Undocumented |
Method | _iter_impl |
Undocumented |
Method | _iterator_getter |
Undocumented |
Method | _manyrow_getter |
Undocumented |
Method | _next_impl |
Undocumented |
Method | _onerow_getter |
Undocumented |
Method | _only_one_row |
Undocumented |
Method | _raw_all_rows |
Undocumented |
Method | _row_getter |
Undocumented |
Method | _unique_strategy |
Undocumented |
Class Variable | _post_creational_filter |
Undocumented |
Class Variable | _real_result |
Undocumented |
Instance Variable | _generate_rows |
Undocumented |
Inherited from InPlaceGenerative
(via IteratorResult
, Result
, ResultInternal
):
Method | _generate |
Undocumented |
Undocumented
Configure the row-fetching strategy to fetch num rows at a time.
This impacts the underlying behavior of the result when iterating over
the result object, or otherwise making use of methods such as
_engine.Result.fetchone
that return one row at a time. Data
from the underlying cursor or other data source will be buffered up to
this many rows in memory, and the buffered collection will then be
yielded out one row at at time or as many rows are requested. Each time
the buffer clears, it will be refreshed to this many rows or as many
rows remain if fewer remain.
The _engine.Result.yield_per
method is generally used in
conjunction with the
:paramref:`_engine.Connection.execution_options.stream_results`
execution option, which will allow the database dialect in use to make
use of a server side cursor, if the DBAPI supports it.
Most DBAPIs do not use server side cursors by default, which means all
rows will be fetched upfront from the database regardless of the
_engine.Result.yield_per
setting. However,
_engine.Result.yield_per
may still be useful in that it batches
the SQLAlchemy-side processing of the raw data from the database, and
additionally when used for ORM scenarios will batch the conversion of
database rows into ORM entity rows.
Parameters | |
num | number of rows to fetch each time the buffer is refilled. If set to a value below 1, fetches all rows for the next buffer. |