def GetBigQueryClient(service_account=None, private_key=None, project_id=None,
                      dataset_id=None):
  service_account = service_account or config_lib.CONFIG[
      "BigQuery.service_account"]
  private_key = private_key or config_lib.CONFIG["BigQuery.private_key"]
  project_id = project_id or config_lib.CONFIG["BigQuery.project_id"]
  dataset_id = dataset_id or config_lib.CONFIG["BigQuery.dataset_id"]

  if not(service_account and private_key and project_id and dataset_id):
    raise RuntimeError("BigQuery.service_account, BigQuery.private_key, "
                       "BigQuery.project_id and BigQuery.dataset_id "
                       "must be defined.")

  creds = SignedJwtAssertionCredentials(service_account, private_key,
                                        scope=BIGQUERY_SCOPE)
  http = httplib2.Http()
  http = creds.authorize(http)
  service = build("bigquery", "v2", http=http)
  return BigQueryClient(project_id=project_id, bq_service=service,
                        dataset_id=dataset_id)
Create a BigQueryClient.
dataset/ETHPy150Open google/grr/grr/lib/bigquery.py/GetBigQueryClient