Skip to content

Commit

Permalink
Change: [BigQuery] only specify useLegacySQL is it's False
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr authored Nov 22, 2016
1 parent 3532890 commit 266ff0d
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 266ff0d

Please sign in to comment.