diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index 09558a14a..f96bc1381 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -1,3 +1,4 @@ +from concurrent.futures import TimeoutError import json import re from contextlib import contextmanager @@ -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.""" diff --git a/tests/unit/test_bigquery_adapter.py b/tests/unit/test_bigquery_adapter.py index 34abd0caf..248e8e2be 100644 --- a/tests/unit/test_bigquery_adapter.py +++ b/tests/unit/test_bigquery_adapter.py @@ -20,7 +20,7 @@ from dbt.adapters.bigquery.connections import _sanitize_label, _VALIDATE_LABEL_LENGTH_LIMIT from dbt_common.clients import agate_helper import dbt_common.exceptions -from dbt.context.manifest import generate_query_header_context +from dbt.context.query_header import generate_query_header_context from dbt.contracts.files import FileHash from dbt.contracts.graph.manifest import ManifestStateCheck from dbt.logger import GLOBAL_LOGGER as logger # noqa