Skip to content

Commit

Permalink
Undo partition exclusion from the table name when splitting a full Bi…
Browse files Browse the repository at this point in the history
…gQuery table name (apache#42541)
  • Loading branch information
moiseenkov authored and ellisms committed Nov 13, 2024
1 parent 5bf6b16 commit 56378b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions airflow/providers/google/cloud/hooks/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2418,10 +2418,6 @@ def var_print(var_name):
f"{var_print(var_name)}Expect format of (<project.|<project:)<dataset>.<table>, "
f"got {table_input}"
)

# Exclude partition from the table name
table_id = table_id.split("$")[0]

if project_id is None:
if var_name is not None:
self.log.info(
Expand Down
7 changes: 2 additions & 5 deletions tests/providers/google/cloud/hooks/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,6 @@ def test_split_tablename_internal_need_default_project(self):
with pytest.raises(ValueError, match="INTERNAL: No default project is specified"):
self.hook.split_tablename("dataset.table", None)

@pytest.mark.parametrize("partition", ["$partition", ""])
@pytest.mark.parametrize(
"project_expected, dataset_expected, table_expected, table_input",
[
Expand All @@ -1045,11 +1044,9 @@ def test_split_tablename_internal_need_default_project(self):
("alt1:alt", "dataset", "table", "alt1:alt:dataset.table"),
],
)
def test_split_tablename(
self, project_expected, dataset_expected, table_expected, table_input, partition
):
def test_split_tablename(self, project_expected, dataset_expected, table_expected, table_input):
default_project_id = "project"
project, dataset, table = self.hook.split_tablename(table_input + partition, default_project_id)
project, dataset, table = self.hook.split_tablename(table_input, default_project_id)
assert project_expected == project
assert dataset_expected == dataset
assert table_expected == table
Expand Down

0 comments on commit 56378b7

Please sign in to comment.