Skip to content

Commit 42f2106

Browse files
krzysztof-kwittcpcloud
authored andcommitted
fix(bigquery): move connection logic to do_connect
1 parent 09d8995 commit 42f2106

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

ibis/backends/bigquery/__init__.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _from_url(self, url):
7676
dataset_id=result.path[1:] or params.get("dataset_id", [""])[0],
7777
)
7878

79-
def connect(
79+
def do_connect(
8080
self,
8181
project_id: str | None = None,
8282
dataset_id: str = "",
@@ -86,7 +86,7 @@ def connect(
8686
auth_external_data: bool = False,
8787
auth_cache: str = "default",
8888
partition_column: str | None = "PARTITIONTIME",
89-
) -> "Backend":
89+
):
9090
"""Create a :class:`Backend` for use with Ibis.
9191
9292
Parameters
@@ -168,22 +168,18 @@ def connect(
168168

169169
project_id = project_id or default_project_id
170170

171-
new_backend = self.__class__()
172-
173171
(
174-
new_backend.data_project,
175-
new_backend.billing_project,
176-
new_backend.dataset,
172+
self.data_project,
173+
self.billing_project,
174+
self.dataset,
177175
) = parse_project_and_dataset(project_id, dataset_id)
178176

179-
new_backend.client = bq.Client(
180-
project=new_backend.billing_project,
177+
self.client = bq.Client(
178+
project=self.billing_project,
181179
credentials=credentials,
182180
client_info=_create_client_info(application_name),
183181
)
184-
new_backend.partition_column = partition_column
185-
186-
return new_backend
182+
self.partition_column = partition_column
187183

188184
def _parse_project_and_dataset(self, dataset) -> tuple[str, str]:
189185
if not dataset and not self.dataset:

0 commit comments

Comments
 (0)