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

Preserve nicely formatted timeout exception #1187

Merged
merged 5 commits into from
Apr 19, 2024
Merged
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
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
2 changes: 1 addition & 1 deletion tests/unit/test_bigquery_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading