class ChunkedIteratorResult(IteratorResult[
An :class:`_engine.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. .. versionadded:: 1.4
Method | __init__ |
Undocumented |
Method | yield |
Configure the row-fetching strategy to fetch ``num`` rows at a time. |
Instance Variable | chunks |
Undocumented |
Instance Variable | dynamic |
Undocumented |
Instance Variable | iterator |
Undocumented |
Instance Variable | raw |
Undocumented |
Method | _fetchmany |
Undocumented |
Method | _soft |
Undocumented |
Instance Variable | _metadata |
Undocumented |
Instance Variable | _source |
Undocumented |
Instance Variable | _yield |
Undocumented |
Inherited from IteratorResult
:
Property | closed |
Return ``True`` if this :class:`_engine.IteratorResult` has been closed |
Method | _fetchall |
Undocumented |
Method | _fetchiter |
Undocumented |
Method | _fetchone |
Undocumented |
Method | _raise |
Undocumented |
Method | _raw |
Return a safe iterator that yields raw row data. |
Instance Variable | _hard |
Undocumented |
Instance Variable | _soft |
Undocumented |
Inherited from Result
(via IteratorResult
):
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __next__ |
Undocumented |
Method | all |
Return all rows in a list. |
Method | close |
close this :class:`_engine.Result`. |
Method | columns |
Establish the columns that should be returned in each row. |
Method | fetchall |
A synonym for the :meth:`_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 :class:`_engine.Result` when invoked. |
Method | mappings |
Apply a mappings filter to returned rows, returning an instance of :class:`_engine.MappingResult`. |
Method | merge |
Merge this :class:`_engine.Result` with other compatible result objects. |
Method | one |
Return exactly one row or raise an exception. |
Method | one |
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 |
Return exactly one scalar result or raise an exception. |
Method | scalar |
Return exactly one scalar result or ``None``. |
Method | scalars |
Return a :class:`_engine.ScalarResult` filtering object which will return single elements rather than :class:`_row.Row` objects. |
Method | tuples |
Apply a "typed tuple" typing filter to returned rows. |
Method | unique |
Apply unique filtering to the objects returned by this :class:`_engine.Result`. |
Class Variable | __slots__ |
Undocumented |
Property | t |
Apply a "typed tuple" typing filter to returned rows. |
Method | _getter |
return a callable that will retrieve the given key from a :class:`_engine.Row`. |
Method | _tuple |
return a callable that will retrieve the given keys from a :class:`_engine.Row`. |
Class Variable | _attributes |
Undocumented |
Class Variable | _row |
Undocumented |
Instance Variable | _unique |
Undocumented |
Inherited from _WithKeys
(via IteratorResult
, Result
):
Method | keys |
Return an iterable view which yields the string keys that would be represented by each :class:`_engine.Row`. |
Inherited from ResultInternal
(via IteratorResult
, Result
, _WithKeys
):
Method | _allrows |
Undocumented |
Method | _column |
Undocumented |
Method | _iter |
Undocumented |
Method | _iterator |
Undocumented |
Method | _manyrow |
Undocumented |
Method | _next |
Undocumented |
Method | _onerow |
Undocumented |
Method | _only |
Undocumented |
Method | _raw |
Undocumented |
Method | _row |
Undocumented |
Method | _unique |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _post |
Undocumented |
Class Variable | _real |
Undocumented |
Instance Variable | _generate |
Undocumented |
Inherited from InPlaceGenerative
(via IteratorResult
, Result
, _WithKeys
, ResultInternal
):
Method | _generate |
Undocumented |
ResultMetaData
, chunks: Callable[ [ Optional[ int]], Iterator[ Sequence[ _InterimRowType[ _R]]]]
, source_supports_scalars: bool
= False, raw: Optional[ Result[ Any]]
= None, dynamic_yield_per: bool
= False):
(source)
¶
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 :meth:`_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 a 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 :meth:`_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 a specific "server side cursor" mode separate from its default mode of operation. .. tip:: Consider using the :paramref:`_engine.Connection.execution_options.yield_per` execution option, which will simultaneously set :paramref:`_engine.Connection.execution_options.stream_results` to ensure the use of server side cursors, as well as automatically invoke the :meth:`_engine.Result.yield_per` method to establish a fixed row buffer size at once. The :paramref:`_engine.Connection.execution_options.yield_per` execution option is available for ORM operations, with :class:`_orm.Session`-oriented use described at :ref:`orm_queryguide_yield_per`. The Core-only version which works with :class:`_engine.Connection` is new as of SQLAlchemy 1.4.40. .. versionadded:: 1.4 :param 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. .. seealso:: :ref:`engine_stream_results` - describes Core behavior for :meth:`_engine.Result.yield_per` :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel`
Optional[ int]
= None) -> List[ _InterimRowType[ Row[ Any]]]
:
(source)
¶
Undocumented