Skip to content

Commit

Permalink
fix(bigquery): use own value for deadline, instead of importing (#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaFaer authored Apr 8, 2024
1 parent 4eb8317 commit 0df2f58
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dlt/destinations/impl/bigquery/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
)

0 comments on commit 0df2f58

Please sign in to comment.