Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 2db7c95

Browse files
Preserve nicely formatted timeout exception (#1187) (#1193)
* 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)
1 parent 73d209d commit 2db7c95

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dbt/adapters/bigquery/connections.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from concurrent.futures import TimeoutError
12
import json
23
import re
34
from contextlib import contextmanager
@@ -726,9 +727,12 @@ def _query_and_results(
726727
logger.debug(
727728
self._bq_job_link(query_job.location, query_job.project, query_job.job_id)
728729
)
729-
730-
iterator = query_job.result(max_results=limit, timeout=job_execution_timeout)
731-
return query_job, iterator
730+
try:
731+
iterator = query_job.result(max_results=limit, timeout=job_execution_timeout)
732+
return query_job, iterator
733+
except TimeoutError:
734+
exc = f"Operation did not complete within the designated timeout of {job_execution_timeout} seconds."
735+
raise TimeoutError(exc)
732736

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

0 commit comments

Comments
 (0)