Skip to content

Commit

Permalink
Move variable definition outside try/except block
Browse files Browse the repository at this point in the history
the variable definition is used in the except block, so if the
variable definition fails, the except block will raise another
variable not defined exception
  • Loading branch information
austinweisgrau committed Apr 3, 2024
1 parent 66573e6 commit ddc788c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions parsons/google/google_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,13 +1329,14 @@ def _validate_copy_inputs(self, if_exists: str, data_type: str):
)

def _load_table_from_uri(self, source_uris, destination, job_config, **load_kwargs):
load_job = self.client.load_table_from_uri(
source_uris=source_uris,
destination=destination,
job_config=job_config,
**load_kwargs,
)

try:
load_job = self.client.load_table_from_uri(
source_uris=source_uris,
destination=destination,
job_config=job_config,
**load_kwargs,
)
load_job.result()
return load_job
except exceptions.BadRequest as e:
Expand Down

0 comments on commit ddc788c

Please sign in to comment.