Class Connection (2.7.0)

Connection(client=None, bqstorage_client=None)

DB-API Connection to Google BigQuery.

Parameters

NameDescription
client Optional[google.cloud.bigquery.Client]

A REST API client used to connect to BigQuery. If not passed, a client is created using default options inferred from the environment.

bqstorage_client Optional[google.cloud.bigquery_storage_v1.BigQueryReadClient]

A client that uses the faster BigQuery Storage API to fetch rows from BigQuery. If not passed, it is created using the same credentials as client (provided that BigQuery Storage dependencies are installed). If both clients are available, bqstorage_client is used for fetching query results.

Inheritance

builtins.object > Connection

Methods

close

close()

Close the connection and any cursors created from it.

Any BigQuery clients explicitly passed to the constructor are not closed, only those created by the connection instance itself.

commit

commit()

No-op, but for consistency raise an error if connection is closed.

cursor

cursor()

Return a new cursor object.

Returns
TypeDescription
google.cloud.bigquery.dbapi.CursorA DB-API cursor that uses this connection.