@snippet
def client_run_sync_query_timeout(client, _):
 TIMEOUT_MS = 10
 all_rows = []
 def do_something_with(rows):
  all_rows.extend(rows)
 query = client.run_sync_query(QUERY)
 query.timeout_ms = TIMEOUT_MS
 query.use_query_cache = False
 query.run()
 assert (not query.complete)
 job = query.job
 job.reload()
 retry_count = 0
 while ((retry_count < 10) and (job.state != u'DONE')):
  time.sleep((1.5 ** retry_count))
  retry_count += 1
  job.reload()
 assert (job.state == u'DONE')
 (rows, total_count, token) = query.fetch_data()
 while True:
  do_something_with(rows)
  if (token is None):
   break
  (rows, total_count, token) = query.fetch_data(page_token=token)
 assert (len(all_rows) == total_count)

@ snippet def client_run_sync_query_timeout ( client , _ ) : TIMEOUT_MS = 10 all_rows = [ ] def do_something_with ( rows ) : all_rows . extend ( rows ) query = client . run_sync_query ( QUERY ) query . timeout_ms = TIMEOUT_MS query . use_query_cache = False query . run ( ) assert ( not query . complete ) job = query . job job . reload ( ) retry_count = 0 while ( ( retry_count < 10 ) and ( job . state != u'DONE' ) ) : time . sleep ( ( 1.5 ** retry_count ) ) retry_count += 1 job . reload ( ) assert ( job . state == u'DONE' ) ( rows , total_count , token ) = query . fetch_data ( ) while True : do_something_with ( rows ) if ( token is None ) : break ( rows , total_count , token ) = query . fetch_data ( page_token = token ) assert ( len ( all_rows ) == total_count )
run a synchronous query w/ timeout .