Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a13ca4

Browse files
committed
simplified error handling to return from exception
1 parent77e62c5 commit7a13ca4

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

‎bigquery/google/cloud/bigquery/magics.py‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,13 @@ def _cell_magic(line, query):
444444
else:
445445
max_results=None
446446

447-
error=None
448-
449447
ifnotre.search(r"\s",query.rstrip()):
450448
table_id=query.rstrip()
451449

452450
try:
453451
rows=client.list_rows(table_id,max_results=max_results)
454452
exceptExceptionasex:
455-
error=str(ex)
456-
iferror:
457-
_print_error(error,args.destination_var)
458-
return
453+
return_print_error(str(ex),args.destination_var)
459454

460455
result=rows.to_dataframe(bqstorage_client=bqstorage_client)
461456
ifargs.destination_var:
@@ -478,15 +473,11 @@ def _cell_magic(line, query):
478473
try:
479474
query_job=_run_query(client,query,job_config=job_config)
480475
exceptExceptionasex:
481-
error=str(ex)
476+
return_print_error(str(ex),args.destination_var)
482477

483478
ifnotargs.verbose:
484479
display.clear_output()
485480

486-
iferror:
487-
_print_error(error,args.destination_var)
488-
return
489-
490481
ifargs.dry_runandargs.destination_var:
491482
IPython.get_ipython().push({args.destination_var:query_job})
492483
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp