Class ReadRowsPage (2.27.0)

ReadRowsPage(stream_parser, message)

An iterator of rows from a read session message.

Parameters

Name Description
stream_parser google.cloud.bigquery_storage_v1.reader._StreamParser

A helper for parsing messages into rows.

message google.cloud.bigquery_storage_v1.types.ReadRowsResponse

A message of data from a read rows stream.

Properties

num_items

int: Total items in the page.

remaining

int: Remaining items in the page.

Methods

__iter__

__iter__()

A ReadRowsPage is an iterator.

__next__

__next__()

Get the next row in the page.

next

next()

Get the next row in the page.

to_arrow

to_arrow()

Create an pyarrow.RecordBatch of rows in the page.

Returns
Type Description
pyarrow.RecordBatch Rows from the message, as an Arrow record batch.

to_dataframe

to_dataframe(dtypes=None)

Create a pandas.DataFrame of rows in the page.

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.