From 91e529ab08076af85eeb2727aa3078aa0b56eea0 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 3 Jan 2023 17:01:39 -0600 Subject: [PATCH] fix: address compatibility issues in `table()` with fully-qualified table names (#153) * fix: address compatibility issues in `table()` with fully-qualified table names * fix mypy --- ibis_bigquery/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ibis_bigquery/__init__.py b/ibis_bigquery/__init__.py index c32c4bc..0bda7ca 100644 --- a/ibis_bigquery/__init__.py +++ b/ibis_bigquery/__init__.py @@ -188,11 +188,12 @@ def table(self, name, database=None) -> ir.TableExpr: return rename_partitioned_column(t, bq_table, self.partition_column) def _fully_qualified_name(self, name, database): - default_project, default_dataset = self._parse_project_and_dataset(database) parts = name.split(".") if len(parts) == 3: return name - elif len(parts) == 2: + + default_project, default_dataset = self._parse_project_and_dataset(database) + if len(parts) == 2: return "{}.{}".format(default_project, name) elif len(parts) == 1: return "{}.{}.{}".format(default_project, default_dataset, name) @@ -324,7 +325,7 @@ def exists_database(self, name): else: return True - def exists_table(self, name: str, database: str = None) -> bool: + def exists_table(self, name: str, database: Optional[str] = None) -> bool: """ Return whether a table name exists in the database.