

def _submit_query_job(self, query_data):
    ' Submit a query job to BigQuery.\n\n            This is similar to BigQueryClient.query, but gives the user\n            direct access to the query method on the offical BigQuery\n            python client.\n\n            For fine-grained control over a query job, see:\n            https://google-api-client-libraries.appspot.com/documentation/bigquery/v2/python/latest/bigquery_v2.jobs.html#query\n\n        Parameters\n        ----------\n        query_data\n            query object as per "configuration.query" in\n            https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query\n\n        Returns\n        -------\n        tuple\n            job id and query results if query completed. If dry_run is True,\n            job id will be None and results will be empty if the query is valid\n            or a dict containing the response if invalid.\n\n        Raises\n        ------\n        BigQueryTimeoutException\n            On timeout\n        '
    logger.debug(('Submitting query job: %s' % query_data))
    job_collection = self.bigquery.jobs()
    try:
        query_reply = job_collection.query(projectId=self.project_id, body=query_data).execute()
    except HttpError as e:
        if query_data.get('dryRun', False):
            return (None, json.loads(e.content.decode('utf8')))
        raise
    job_id = query_reply['jobReference'].get('jobId')
    schema = query_reply.get('schema', {
        'fields': None,
    })['fields']
    rows = query_reply.get('rows', [])
    job_complete = query_reply.get('jobComplete', False)
    if ((not job_complete) and query_data.get('timeoutMs', False)):
        logger.error(('BigQuery job %s timeout' % self))
        raise BigQueryTimeoutException()
    return (job_id, [self._transform_row(row, schema) for row in rows])

dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/client.py BigQueryClient._submit_query_job/VarMisuse@185/589 `job_id`->`self`