From 266ff0d4465c9a835ad6d43517464f149580a272 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Tue, 22 Nov 2016 23:25:10 +0200 Subject: [PATCH] Change: [BigQuery] only specify useLegacySQL is it's False --- query_runner/big_query.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/query_runner/big_query.py b/query_runner/big_query.py index 2a193314ea..ece6634b38 100644 --- a/query_runner/big_query.py +++ b/query_runner/big_query.py @@ -147,8 +147,11 @@ def _get_total_bytes_processed(self, jobs, query): job_data = { "query": query, "dryRun": True, - "useLegacySql": not self.configuration.get('useStandardSql', False), } + + if self.configuration.get('useStandardSql', False): + job_data['useLegacySql'] = False + response = jobs.query(projectId=self._get_project_id(), body=job_data).execute() return int(response["totalBytesProcessed"]) @@ -158,10 +161,13 @@ def _get_query_result(self, jobs, query): "configuration": { "query": { "query": query, - "useLegacySql": not self.configuration.get('useStandardSql', False), } } } + + if self.configuration.get('useStandardSql', False): + job_data['configuration']['query']['useLegacySql'] = False + if "userDefinedFunctionResourceUri" in self.configuration: resource_uris = self.configuration["userDefinedFunctionResourceUri"].split(',')