Skip to content

Commit

Permalink
[BigQuery] Fix: in some queries there is no mode field (getredash#3786)
Browse files Browse the repository at this point in the history
Happened with INSERT/UPDATE queries.
  • Loading branch information
arikfr authored and harveyrendell committed Nov 14, 2019
1 parent 3cf9c96 commit 2b48def
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redash/query_runner/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def transform_row(row, fields):

for column_index, cell in enumerate(row["f"]):
field = fields[column_index]
if field['mode'] == 'REPEATED':
if field.get('mode') == 'REPEATED':
cell_value = [transform_cell(field['type'], item['v']) for item in cell['v']]
else:
cell_value = transform_cell(field['type'], cell['v'])
Expand Down Expand Up @@ -231,7 +231,7 @@ def _get_query_result(self, jobs, query):
columns = [{
'name': f["name"],
'friendly_name': f["name"],
'type': "string" if f['mode'] == "REPEATED"
'type': "string" if f.get('mode') == "REPEATED"
else types_map.get(f['type'], "string")
} for f in query_reply["schema"]["fields"]]

Expand Down

0 comments on commit 2b48def

Please sign in to comment.