bigframes.streaming.StreamingDataFrame#

class bigframes.streaming.StreamingDataFrame(df: DataFrame, *, create_key=0)[source]#

Two-dimensional, size-mutable, potentially heterogeneous tabular data.

Data structure also contains labeled axes (rows and columns). Arithmetic operations align on both row and column labels. Can be thought of as a dict-like container for Series objects. The primary pandas data structure.

Note

The bigframes.streaming module is a preview feature, and subject to change.

Currently only supports basic projection, filtering and preview operations.

__getitem__(*args, **kwargs)[source]#

Gets the specified column(s) from the StreamingDataFrame.

Parameters:

key (index) – Index or list of indices. It can be a column label, a list of column labels, a Series of booleans or a pandas Index of desired column labels

Returns:

Value(s) at the requested index(es).

Return type:

bigframes.pandas.Series or Any

__repr__(*args, **kwargs)[source]#

Converts a StreamingDataFrame to a string. Calls to_pandas.

Only represents the first bigframes.options.display.max_rows.

__setitem__(*args, **kwargs)[source]#

Modify or insert a column into the StreamingDataFrame.

Note

This does not modify the original table the StreamingDataFrame was derived from.

Parameters:
  • key (column index) – It can be a new column to be inserted, or an existing column to be modified.

  • value (scalar, Sequence, StreamingDataFrame, or Series) – Value to be assigned to the column

rename(*args, **kwargs)[source]#

Rename columns.

Dict values must be unique (1-to-1). Labels not contained in a dict will be left as-is. Extra labels listed don’t throw an error.

Parameters:
  • columns (Mapping) – Dict-like from old column labels to new column labels.

  • inplace (bool) – Default False. Whether to modify the StreamingDataFrame rather than creating a new one.

Returns:

StreamingDataFrame with the renamed axis labels or None if inplace=True.

Return type:

bigframes.pandas.DataFrame | None

Raises:

KeyError – If any of the labels is not found.

property sql#

Compiles this StreamingDataFrame’s expression tree to SQL.

Returns:

string representing the compiled SQL.

Return type:

str

to_bigtable(*, instance: str, table: str, service_account_email: str | None = None, app_profile: str | None = None, truncate: bool = False, overwrite: bool = False, auto_create_column_families: bool = False, bigtable_options: dict | None = None, job_id: str | None = None, job_id_prefix: str | None = None, start_timestamp: int | float | str | datetime | date | None = None, end_timestamp: int | float | str | datetime | date | None = None) → QueryJob#

Export the StreamingDataFrame as a continue job and returns a QueryJob object for some management functionality.

This method requires an existing bigtable preconfigured to accept the continuous query export statement. For instructions on export to bigtable, see https://cloud.google.com/bigquery/docs/export-to-bigtable.

Parameters:
Returns:

See https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJob The ongoing query job can be managed using this object. For example, the job can be cancelled or its error status can be examined.

Return type:

google.cloud.bigquery.QueryJob

to_pubsub(*, topic: str, service_account_email: str, job_id: str | None = None, job_id_prefix: str | None = None, start_timestamp: int | float | str | datetime | date | None = None) → QueryJob#

Export the StreamingDataFrame as a continue job and returns a QueryJob object for some management functionality.

This method requires an existing pubsub topic. For instructions on creating a pubsub topic, see https://cloud.google.com/pubsub/docs/samples/pubsub-quickstart-create-topic?hl=en

Note that a service account is a requirement for continuous queries exporting to pubsub.

Parameters:
Returns:

See https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJob The ongoing query job can be managed using this object. For example, the job can be cancelled or its error status can be examined.

Return type:

google.cloud.bigquery.QueryJob