Skip to content

Commit

Permalink
feat(bigquery): implement from_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jul 22, 2024
1 parent 312290e commit 4bd25c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ibis/backends/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ def from_connection(
client: bq.Client,
partition_column: str | None = "PARTITIONTIME",
storage_client: bqstorage.BigQueryReadClient | None = None,
dataset_id: str = "",
) -> Backend:
"""Create a BigQuery `Backend` from an existing ``Client``.
Expand All @@ -499,12 +500,18 @@ def from_connection(
A ``BigQueryReadClient`` from the
``google.cloud.bigquery_storage_v1`` package. If not set, one is
created using the ``project_id`` and ``credentials``.
dataset_id
A dataset id that lives inside of the project indicated by
`project_id`.
"""
return ibis.bigquery.Backend.connect(
con = ibis.bigquery.connect(
client=client,
partition_column=partition_column,
storage_client=storage_client,
dataset_id=dataset_id,
)
con._can_reconnect = False
return con

def disconnect(self) -> None:
self.client.close()
Expand Down

0 comments on commit 4bd25c5

Please sign in to comment.