Skip to content

Commit

Permalink
Fixing error with sqllab numpy array
Browse files Browse the repository at this point in the history
(cherry picked from commit cf8a72b)
  • Loading branch information
michellethomas committed Mar 19, 2018
1 parent 55e20ae commit d5cbcbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def convert_results_to_df(cursor_description, data):
if data:
first_row = data[0]
has_dict_col = any([isinstance(c, dict) for c in first_row])
df_data = list(data) if has_dict_col else np.array(data)
df_data = list(data) if has_dict_col else np.array(data, dtype=object)
else:
df_data = []

Expand Down
4 changes: 2 additions & 2 deletions tests/sqllab_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def test_alias_duplicate(self):
raise_on_error=True)

def test_df_conversion_no_dict(self):
cols = [['string_col'], ['int_col']]
data = [['a', 4]]
cols = [['string_col'], ['int_col'], ['float_col']]
data = [['a', 4, 4.0]]
cdf = convert_results_to_df(cols, data)

self.assertEquals(len(data), cdf.size)
Expand Down

0 comments on commit d5cbcbf

Please sign in to comment.