@@ -125,7 +125,7 @@ def __init__(self):
125125 self ._default_query_job_config = bigquery .QueryJobConfig ()
126126 self ._bigquery_client_options = client_options .ClientOptions ()
127127 self ._bqstorage_client_options = client_options .ClientOptions ()
128- self ._progress_bar_type = "tqdm "
128+ self ._progress_bar_type = "tqdm_notebook "
129129
130130 @property
131131 def credentials (self ):
@@ -269,7 +269,7 @@ def progress_bar_type(self):
269269 Manually setting the progress_bar_type:
270270
271271 >>> from google.cloud.bigquery import magics
272- >>> magics.context.progress_bar_type = "tqdm "
272+ >>> magics.context.progress_bar_type = "tqdm_notebook "
273273 """
274274 return self ._progress_bar_type
275275
@@ -286,7 +286,7 @@ def _handle_error(error, destination_var=None):
286286
287287 Args:
288288 error (Exception):
289- An exception that ocurred during the query exectution .
289+ An exception that ocurred during the query execution .
290290 destination_var (Optional[str]):
291291 The name of the IPython session variable to store the query job.
292292 """
@@ -329,22 +329,25 @@ def _run_query(client, query, job_config=None):
329329 Query complete after 2.07s
330330 'bf633912-af2c-4780-b568-5d868058632b'
331331 """
332- start_time = time .time ()
332+ start_time = time .perf_counter ()
333333 query_job = client .query (query , job_config = job_config )
334334
335335 if job_config and job_config .dry_run :
336336 return query_job
337337
338- print ("Executing query with job ID: {}" . format ( query_job .job_id ) )
338+ print (f "Executing query with job ID: { query_job .job_id } " )
339339
340340 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+ )
342345 try :
343346 query_job .result (timeout = 0.5 )
344347 break
345348 except futures .TimeoutError :
346349 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" )
348351 return query_job
349352
350353
@@ -365,7 +368,7 @@ def _create_dataset_if_necessary(client, dataset_id):
365368 pass
366369 dataset = bigquery .Dataset (dataset_reference )
367370 dataset .location = client .location
368- print ("Creating dataset: {}" . format ( dataset_id ) )
371+ print (f "Creating dataset: { dataset_id } " )
369372 dataset = client .create_dataset (dataset )
370373
371374
@@ -500,7 +503,7 @@ def _create_dataset_if_necessary(client, dataset_id):
500503 default = None ,
501504 help = (
502505 "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."
504507 ),
505508)
506509def _cell_magic (line , query ):
0 commit comments