Skip to content

Commit

Permalink
add token refresh as retry-able error, add retry to table metadata query
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Oct 25, 2024
1 parent 79fbd90 commit 09a8140
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
)

RETRYABLE_ERRORS = (
google.auth.exceptions.RefreshError,
google.cloud.exceptions.ServerError,
google.cloud.exceptions.BadRequest,
google.cloud.exceptions.BadGateway,
Expand Down Expand Up @@ -739,7 +740,12 @@ def get_bq_table(self, database, schema, identifier):
database = database or conn.credentials.database
schema = schema or conn.credentials.schema
table_ref = self.table_ref(database, schema, identifier)
return conn.handle.get_table(table_ref)
client = conn.handle

def fn():
return client.get_table(table_ref)

return self._retry_and_handle(msg="get table", conn=conn, fn=fn)

def drop_dataset(self, database, schema):
conn = self.get_thread_connection()
Expand Down

0 comments on commit 09a8140

Please sign in to comment.