Missed TensorFlow World? Check out the recap. Learn more

tfio.bigquery.BigQueryClient

View source on GitHub

Class BigQueryClient

BigQueryClient is the entrypoint for interacting with Cloud BigQuery in TF.

BigQueryClient encapsulates a connection to Cloud BigQuery, and exposes the readSession method to initiate a BigQuery read session.

__init__

View source

__init__()

Creates a BigQueryClient to start BigQuery read sessions.

Methods

read_session

View source

read_session(
    parent,
    project_id,
    table_id,
    dataset_id,
    selected_fields,
    output_types=None,
    row_restriction='',
    requested_streams=1
)

Opens a session and returns a BigQueryReadSession object.

Args:

  • parent: String of the form projects/{project_id} indicating the project this ReadSession is associated with. This is the project that will be billed for usage.
  • project_id: The assigned project ID of the project.
  • table_id: The ID of the table in the dataset.
  • dataset_id: The ID of the dataset in the project.
  • selected_fields: Names of the fields in the table that should be read. The output field order is unrelated to the order of fields in selected_fields.
  • output_types: Types for the output tensor in the same sequence as selected_fields. If not specified, DT_STRING is implied for all Tensors.
  • row_restriction: Optional. SQL text filtering statement, similar to a WHERE clause in a query.
  • requested_streams: Initial number of streams. If unset or 0, we will provide a value of streams so as to produce reasonable throughput. Must be non-negative. The number of streams may be lower than the requested number, depending on the amount parallelism that is reasonable for the table and the maximum amount of parallelism allowed by the system.

Returns:

A BigQueryReadSession Python object representing the operations available on the table.