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



##########
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:
       @bkyryliuk this query was raising an exception, as either the type for 
`intcol` or `strcol` was returned as `OTHER`, indicating that the type wasn't 
found in `models/sql_types/presto_sql_types.py:type_map`




----------------------------------------------------------------
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