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(',')