Browse Source

HUE-8737 [sqlalchemy] Remove enum lib and list columns properly

Romain 5 years ago
parent
commit
fa49f68dd2

+ 1 - 3
desktop/core/requirements_py3.txt

@@ -34,8 +34,6 @@ django-timezone-field==3.0
 django-webpack-loader==0.5.0
 dnspython==1.15.0
 docutils==0.14
-enum34==1.1.6
-enum-compat==0.0.2
 et_xmlfile==1.0.1
 eventlet==0.24.1
 future==0.18.2
@@ -93,7 +91,7 @@ sasl==0.2.1
 simplejson==3.15.0
 simple-salesforce==0.74.2
 six==1.12.0
-SQLAlchemy==1.3.8
+SQLAlchemy==1.3.15
 sqlparse==0.2.0
 tablib==0.13.0
 thrift==0.13.0

+ 15 - 0
desktop/libs/notebook/src/notebook/connectors/sql_alchemy_tests.py

@@ -200,6 +200,21 @@ class TestApi(object):
           [{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
         )
 
+  def test_get_sample_data_table(self):
+    snippet = Mock()
+
+    with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
+      with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
+        get_sample_data.return_value = (['col1'], [[1], [2]])
+
+        response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet, table='table1')
+
+        assert_equal(response['rows'], [[1], [2]])
+        assert_equal(
+          response['full_headers'],
+          [{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
+        )
+
 
 class TestDialects(object):