@@ -125,7 +125,7 @@ def __init__(self):
125
125
self ._default_query_job_config = bigquery .QueryJobConfig ()
126
126
self ._bigquery_client_options = client_options .ClientOptions ()
127
127
self ._bqstorage_client_options = client_options .ClientOptions ()
128
- self ._progress_bar_type = "tqdm "
128
+ self ._progress_bar_type = "tqdm_notebook "
129
129
130
130
@property
131
131
def credentials (self ):
@@ -269,7 +269,7 @@ def progress_bar_type(self):
269
269
Manually setting the progress_bar_type:
270
270
271
271
>>> from google.cloud.bigquery import magics
272
- >>> magics.context.progress_bar_type = "tqdm "
272
+ >>> magics.context.progress_bar_type = "tqdm_notebook "
273
273
"""
274
274
return self ._progress_bar_type
275
275
@@ -286,7 +286,7 @@ def _handle_error(error, destination_var=None):
286
286
287
287
Args:
288
288
error (Exception):
289
- An exception that ocurred during the query exectution .
289
+ An exception that ocurred during the query execution .
290
290
destination_var (Optional[str]):
291
291
The name of the IPython session variable to store the query job.
292
292
"""
@@ -329,22 +329,25 @@ def _run_query(client, query, job_config=None):
329
329
Query complete after 2.07s
330
330
'bf633912-af2c-4780-b568-5d868058632b'
331
331
"""
332
- start_time = time .time ()
332
+ start_time = time .perf_counter ()
333
333
query_job = client .query (query , job_config = job_config )
334
334
335
335
if job_config and job_config .dry_run :
336
336
return query_job
337
337
338
- print ("Executing query with job ID: {}" . format ( query_job .job_id ) )
338
+ print (f "Executing query with job ID: { query_job .job_id } " )
339
339
340
340
while True :
341
- print ("\r Query executing: {:0.2f}s" .format (time .time () - start_time ), end = "" )
341
+ print (
342
+ f"\r Query executing: { time .perf_counter () - start_time :.2f} s" .format (),
343
+ end = "" ,
344
+ )
342
345
try :
343
346
query_job .result (timeout = 0.5 )
344
347
break
345
348
except futures .TimeoutError :
346
349
continue
347
- print (" \n Query complete after {:0.2f}s" . format ( time . time () - start_time ) )
350
+ print (f" \n Job ID { query_job . job_id } successfully executed" )
348
351
return query_job
349
352
350
353
@@ -365,7 +368,7 @@ def _create_dataset_if_necessary(client, dataset_id):
365
368
pass
366
369
dataset = bigquery .Dataset (dataset_reference )
367
370
dataset .location = client .location
368
- print ("Creating dataset: {}" . format ( dataset_id ) )
371
+ print (f "Creating dataset: { dataset_id } " )
369
372
dataset = client .create_dataset (dataset )
370
373
371
374
@@ -500,7 +503,7 @@ def _create_dataset_if_necessary(client, dataset_id):
500
503
default = None ,
501
504
help = (
502
505
"Sets progress bar type to display a progress bar while executing the query."
503
- "Defaults to use tqdm . Install the ``tqdm`` package to use this feature."
506
+ "Defaults to use tqdm_notebook . Install the ``tqdm`` package to use this feature."
504
507
),
505
508
)
506
509
def _cell_magic (line , query ):
0 commit comments