Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect query in BigQueryAsyncHook.create_job_for_partition_get #44225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ async def create_job_for_partition_get(
query_request = {
"query": "SELECT partition_id "
f"FROM `{project_id}.{dataset_id}.INFORMATION_SCHEMA.PARTITIONS`"
+ (f" WHERE table_id={table_id}" if table_id else ""),
+ (f" WHERE table_name='{table_id}'" if table_id else ""),
"useLegacySql": False,
}
job_query_resp = await job_client.query(query_request, cast(Session, session))
Expand Down
2 changes: 1 addition & 1 deletion providers/tests/google/cloud/hooks/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ async def test_create_job_for_partition_get_with_table(self, mock_job_instance,
expected_query_request = {
"query": "SELECT partition_id "
f"FROM `{PROJECT_ID}.{DATASET_ID}.INFORMATION_SCHEMA.PARTITIONS`"
f" WHERE table_id={TABLE_ID}",
f" WHERE table_name='{TABLE_ID}'",
"useLegacySql": False,
}
await hook.create_job_for_partition_get(
Expand Down