Skip to content

Commit

Permalink
Merge pull request getredash#1421 from getredash/arikfr-patch-1
Browse files Browse the repository at this point in the history
Change: [BigQuery] only specify useLegacySQL is it's True
  • Loading branch information
arikfr authored Nov 22, 2016
2 parents c82fe9b + 266ff0d commit e7b17b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions query_runner/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -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(',')
Expand Down

0 comments on commit e7b17b8

Please sign in to comment.