Class ReadRowsIterable (2.27.0)

ReadRowsIterable(reader, read_session=None)

An iterable of rows from a read session.

Parameters

Name Description
reader google.cloud.bigquery_storage_v1.reader.ReadRowsStream

A read rows stream.

read_session Optional[ReadSession]

This argument was used to specify the schema of the rows in the stream, but now the first message in a read stream contains this information. When row_restriction is applied, some streams may be empty without read_session info. Provide this argument to avoid an error. For more information, see https://github.com/googleapis/python-bigquery-storage/issues/733ß

Properties

pages

A generator of all pages in the stream.

Returns
Type Description
types.GeneratorType[google.cloud.bigquery_storage_v1.ReadRowsPage] A generator of pages.

Methods

__iter__

__iter__()

Iterator for each row in all pages.

to_arrow

to_arrow()

Create a pyarrow.Table of all rows in the stream.

This method requires the pyarrow library and a stream using the Arrow format.

Returns
Type Description
pyarrow.Table A table of all rows in the stream.

to_dataframe

to_dataframe(dtypes=None)

Create a pandas.DataFrame of all rows in the stream.

This method requires the pandas libary to create a data frame and the fastavro library to parse row messages.

Parameter
Name Description
dtypes Map[str, Union[str, pandas.Series.dtype]]

Optional. A dictionary of column names pandas dtypes. The provided dtype is used when constructing the series for the column specified. Otherwise, the default pandas behavior is used.

Returns
Type Description
pandas.DataFrame A data frame of all rows in the stream.