Skip to content

Commit 56c06ad

Browse files
BigQuery: Remove "Job ID" metadata on annotaton to avoid cache misses (#7541)
1 parent 5e8915a commit 56c06ad

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

redash/query_runner/big_query.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ def configuration_schema(cls):
156156
"secret": ["jsonKeyFile"],
157157
}
158158

159+
def annotate_query(self, query, metadata):
160+
# Remove "Job ID" before annotating the query to avoid cache misses
161+
metadata = {k: v for k, v in metadata.items() if k != "Job ID"}
162+
return super().annotate_query(query, metadata)
163+
159164
def _get_bigquery_service(self):
160165
socket.setdefaulttimeout(settings.BIGQUERY_HTTP_TIMEOUT)
161166

tests/query_runner/test_bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_annotate_query_with_use_query_annotation_option(self):
2020
query = "SELECT a FROM tbl"
2121
expect = (
2222
"/* Username: username, query_id: adhoc, "
23-
"Job ID: job-id, Query Hash: query-hash, "
23+
"Query Hash: query-hash, "
2424
"Scheduled: False */ SELECT a FROM tbl"
2525
)
2626

0 commit comments

Comments
 (0)