Skip to content

Commit e7b17b8

Browse files
authored
Merge pull request getredash#1421 from getredash/arikfr-patch-1
Change: [BigQuery] only specify useLegacySQL is it's True
2 parents c82fe9b + 266ff0d commit e7b17b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

query_runner/big_query.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ def _get_total_bytes_processed(self, jobs, query):
147147
job_data = {
148148
"query": query,
149149
"dryRun": True,
150-
"useLegacySql": not self.configuration.get('useStandardSql', False),
151150
}
151+
152+
if self.configuration.get('useStandardSql', False):
153+
job_data['useLegacySql'] = False
154+
152155
response = jobs.query(projectId=self._get_project_id(), body=job_data).execute()
153156
return int(response["totalBytesProcessed"])
154157

@@ -158,10 +161,13 @@ def _get_query_result(self, jobs, query):
158161
"configuration": {
159162
"query": {
160163
"query": query,
161-
"useLegacySql": not self.configuration.get('useStandardSql', False),
162164
}
163165
}
164166
}
167+
168+
if self.configuration.get('useStandardSql', False):
169+
job_data['configuration']['query']['useLegacySql'] = False
170+
165171

166172
if "userDefinedFunctionResourceUri" in self.configuration:
167173
resource_uris = self.configuration["userDefinedFunctionResourceUri"].split(',')

0 commit comments

Comments
 (0)