From 0df2f5846885837b4e5fd91e5508b4c0b0b6ccd5 Mon Sep 17 00:00:00 2001 From: Ilya Gurov Date: Tue, 9 Apr 2024 01:17:44 +0400 Subject: [PATCH] fix(bigquery): use own value for deadline, instead of importing (#1196) --- dlt/destinations/impl/bigquery/bigquery.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dlt/destinations/impl/bigquery/bigquery.py b/dlt/destinations/impl/bigquery/bigquery.py index b2e53f9734..03c42d5b0c 100644 --- a/dlt/destinations/impl/bigquery/bigquery.py +++ b/dlt/destinations/impl/bigquery/bigquery.py @@ -7,7 +7,7 @@ from google.api_core import exceptions as api_core_exceptions from google.cloud import exceptions as gcp_exceptions from google.api_core import retry -from google.cloud.bigquery.retry import _DEFAULT_RETRY_DEADLINE, _RETRYABLE_REASONS +from google.cloud.bigquery.retry import _RETRYABLE_REASONS from dlt.common import json, logger from dlt.common.destination import DestinationCapabilitiesContext @@ -363,9 +363,7 @@ def prepare_load_table( def _get_column_def_sql(self, column: TColumnSchema, table_format: TTableFormat = None) -> str: name = self.capabilities.escape_identifier(column["name"]) - column_def_sql = ( - f"{name} {self.type_mapper.to_db_type(column, table_format)} {self._gen_not_null(column.get('nullable', True))}" - ) + column_def_sql = f"{name} {self.type_mapper.to_db_type(column, table_format)} {self._gen_not_null(column.get('nullable', True))}" if column.get(ROUND_HALF_EVEN_HINT, False): column_def_sql += " OPTIONS (rounding_mode='ROUND_HALF_EVEN')" if column.get(ROUND_HALF_AWAY_FROM_ZERO_HINT, False): @@ -496,5 +494,5 @@ def _should_retry(exc: api_core_exceptions.GoogleAPICallError) -> bool: bq_client.insert_rows_json( full_name, items, - retry=retry.Retry(predicate=_should_retry, deadline=_DEFAULT_RETRY_DEADLINE), + retry=retry.Retry(predicate=_should_retry, deadline=600), # with 10 mins deadline )