#NEWLINE# def run_with_configuration( self , configuration ) : #NEWLINE# #INDENT# "\n        Executes a BigQuery SQL query. See here:\n\n        https://cloud.google.com/bigquery/docs/reference/v2/jobs\n\n        For more details about the configuration parameter.\n\n        :param configuration: The configuration parameter maps directly to\n            BigQuery's configuration field in the job object. See\n            https://cloud.google.com/bigquery/docs/reference/v2/jobs for\n            details.\n        " #NEWLINE# jobs = self . service . jobs ( ) #NEWLINE# job_data = { #NEWLINE# #INDENT# 'configuration' : configuration , #NEWLINE# #UNINDENT# } #NEWLINE# query_reply = jobs . insert ( projectId = self . project_id , body = job_data ) . execute ( ) #NEWLINE# job_id = query_reply [ 'jobReference' ] [ 'jobId' ] #NEWLINE# job = jobs . get ( projectId = self . project_id , jobId = job_id ) . execute ( ) #NEWLINE# while ( not ( job [ 'status' ] [ 'state' ] == 'DONE' ) ) : #NEWLINE# #INDENT# logging . info ( 'Waiting for job to complete: %s, %s' , self . project_id , job_id ) #NEWLINE# time . sleep ( 5 ) #NEWLINE# job = jobs . get ( projectId = self . project_id , jobId = job_id ) . execute ( ) #NEWLINE# #UNINDENT# if ( 'errorResult' in job [ 'status' ] ) : #NEWLINE# #INDENT# raise Exception ( 'BigQuery job failed. Final error was: %s' , job [ 'status' ] [ 'errorResult' ] ) #NEWLINE# #UNINDENT# return job_id