Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
fix: address compatibility issues in table() with fully-qualified t…
Browse files Browse the repository at this point in the history
…able names (#153)

* fix: address compatibility issues in `table()` with fully-qualified table names

* fix mypy
  • Loading branch information
tswast authored Jan 3, 2023
1 parent 9d1d5fc commit 91e529a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ibis_bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 91e529a

Please sign in to comment.