bkyryliuk commented on a change in pull request #10645:
URL: 
https://github.com/apache/incubator-superset/pull/10645#discussion_r489629226



##########
File path: tests/datasource_tests.py
##########
@@ -18,29 +18,85 @@
 import json
 from copy import deepcopy
 
-from superset.utils.core import get_or_create_db
+from superset import db
+from superset.connectors.sqla.models import SqlaTable
+from superset.utils.core import get_example_database
 
 from .base_tests import SupersetTestCase
 from .fixtures.datasource import datasource_post
 
 
 class TestDatasource(SupersetTestCase):
-    def test_external_metadata(self):
+    def test_external_metadata_for_physical_table(self):
         self.login(username="admin")
         tbl = self.get_table_by_name("birth_names")
-        schema = tbl.schema or ""
-        url = (
-            f"/datasource/external_metadata/table/{tbl.id}/?"
-            f"db_id={tbl.database.id}&"
-            f"table_name={tbl.table_name}&"
-            f"schema={schema}&"
-        )
+        url = f"/datasource/external_metadata/table/{tbl.id}/"
         resp = self.get_json_resp(url)
         col_names = {o.get("name") for o in resp}
         self.assertEqual(
             col_names, {"sum_boys", "num", "gender", "name", "ds", "state", 
"sum_girls"}
         )
 
+    def test_external_metadata_for_virtual_table(self):
+        self.login(username="admin")
+        session = db.session
+        table = SqlaTable(
+            schema="main",
+            table_name="dummy_sql_table",
+            database=get_example_database(),
+            sql="select 123 as intcol, 'abc' as strcol",

Review comment:
       I see the same in our deployment:
   
   
![image](https://user-images.githubusercontent.com/5727938/93375649-573b7880-f80d-11ea-861c-a3642d2c5077.png)
   
   Looks like pyhive / sqlalchemy is not happy with the varchar(3)      
   ```
   SHOW COLUMNS FROM bogdankyryliuk.bogdan_simple_test
   --
   intcol       integer         
   strcol       varchar(3)              
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to