From d5cbcbfd517bb94047b09b7ff503e1fe6d1ed433 Mon Sep 17 00:00:00 2001 From: Michelle Thomas Date: Thu, 15 Mar 2018 19:06:36 -0700 Subject: [PATCH] Fixing error with sqllab numpy array (cherry picked from commit cf8a72b5db1718bac4a417d5b002a63609cf9b8a) --- superset/sql_lab.py | 2 +- tests/sqllab_tests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/sql_lab.py b/superset/sql_lab.py index 4dae72720dc97..7b74ab72184af 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -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 = [] diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py index 01b10b262681f..ecaa23ca52f72 100644 --- a/tests/sqllab_tests.py +++ b/tests/sqllab_tests.py @@ -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)