Skip to content

Commit

Permalink
Preserve nicely formatted timeout exception (#1187)
Browse files Browse the repository at this point in the history
* use dynamic schema in test_grant_access_to.py

* use dynamic schema in test_grant_access_to.py

* revert setup

* Add descriptive error message on query timeout

* Add descriptive error message on query timeout

(cherry picked from commit b62ce74)
  • Loading branch information
colin-rogers-dbt committed Apr 24, 2024
1 parent c3b13c7 commit 9980657
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from concurrent.futures import TimeoutError
import json
import re
from contextlib import contextmanager
Expand Down Expand Up @@ -736,9 +737,12 @@ def _query_and_results(
logger.debug(
self._bq_job_link(query_job.location, query_job.project, query_job.job_id)
)

iterator = query_job.result(max_results=limit, timeout=job_execution_timeout)
return query_job, iterator
try:
iterator = query_job.result(max_results=limit, timeout=job_execution_timeout)
return query_job, iterator
except TimeoutError:
exc = f"Operation did not complete within the designated timeout of {job_execution_timeout} seconds."
raise TimeoutError(exc)

def _retry_and_handle(self, msg, conn, fn):
"""retry a function call within the context of exception_handler."""
Expand Down

0 comments on commit 9980657

Please sign in to comment.