bigframes.pandas.read_gbq_table#

bigframes.pandas.read_gbq_table(query: str, *, index_col: Iterable[str] | str | bigframes.enums.DefaultIndexKind = (), columns: Iterable[str] = (), max_results: int | None = None, filters: vendored_pandas_gbq.FiltersType = (), use_cache: bool = True, col_order: Iterable[str] = (), dry_run: Literal[False] = False) bigframes.dataframe.DataFrame[source]#
bigframes.pandas.read_gbq_table(query: str, *, index_col: Iterable[str] | str | bigframes.enums.DefaultIndexKind = (), columns: Iterable[str] = (), max_results: int | None = None, filters: vendored_pandas_gbq.FiltersType = (), use_cache: bool = True, col_order: Iterable[str] = (), dry_run: Literal[True] = False) Series

Turn a BigQuery table into a DataFrame.

Examples:

Read a whole table, with arbitrary ordering or ordering corresponding to the primary key(s).

>>> import bigframes.pandas as bpd
>>> df = bpd.read_gbq_table("bigquery-public-data.ml_datasets.penguins")

See also: Session.read_gbq().

Parameters:
  • table_id (str) – The identifier of the BigQuery table to read.

  • index_col (Iterable[str] or str, optional) – The column(s) to use as the index for the DataFrame. This can be a single column name or a list of column names. If not provided, a default index will be used.

  • columns (Iterable[str], optional) – The columns to read from the table. If not specified, all columns will be read.

  • max_results (int, optional) – The maximum number of rows to retrieve from the table. If not specified, all rows will be loaded.

  • filters (list[tuple], optional) – A list of filters to apply to the data. Filters are specified as a list of tuples, where each tuple contains a column name, an operator (e.g., ‘==’, ‘!=’), and a value.

  • use_cache (bool, optional) – Whether to use cached results for the query. Defaults to True. Setting this to False will force a re-execution of the query.

  • col_order (Iterable[str], optional) – The desired order of columns in the resulting DataFrame. This parameter is deprecated and will be removed in a future version. Use columns instead.

  • dry_run (bool, optional) – If True, the function will not actually execute the query but will instead return statistics about the table. Defaults to False.

Returns:

A DataFrame representing the contents of the table. If dry_run is True, a pandas.Series containing table statistics is returned.

Return type:

bigframes.pandas.DataFrame or pandas.Series

Raises:

ValueError – When both columns and col_order are specified.