Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions redash/query_runner/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def determine_type(cls, data_type, precision, scale):
t = TYPES_MAP.get(data_type, None)
if t == TYPE_INTEGER and scale > 0:
return TYPE_FLOAT
elif t == TYPE_INTEGER and precision >= 16:
elif t == TYPE_INTEGER and precision == 38:
return TYPE_STRING
else:
return t
Expand Down Expand Up @@ -144,8 +144,15 @@ def _parse_results(self, cursor):
columns = self.fetch_columns(
[(self._column_name(i[0]), self.determine_type(i[1], i[4], i[5])) for i in cursor.description]
)
rows = [dict(zip((column["name"] for column in columns), row)) for row in cursor]

rows = []
for row in cursor:
row_dict = {}
for column, value in zip(columns, row):
if column["type"] == TYPE_INTEGER:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[self-review] this isn't going to work since line 93 the type is changed.

row_dict[column["name"]] = str(value) # Cast NUMBER with (38,0) to STRING
else:
row_dict[column["name"]] = value
rows.append(row_dict)
data = {"columns": columns, "rows": rows}
return data

Expand Down