mistercrunch commented on a change in pull request #4593: [sql lab] reduce the 
number of metadata calls when loading a table
URL: 
https://github.com/apache/incubator-superset/pull/4593#discussion_r173887476
 
 

 ##########
 File path: superset/db_engine_specs.py
 ##########
 @@ -235,14 +235,15 @@ def where_latest_partition(
 
     @classmethod
     def select_star(cls, my_db, table_name, schema=None, limit=100,
-                    show_cols=False, indent=True, latest_partition=True):
+                    show_cols=False, indent=True, latest_partition=True,
+                    cols=None):
         fields = '*'
-        cols = []
-        if show_cols or latest_partition:
+        cols = cols or []
+        if (show_cols or latest_partition) and not cols:
             cols = my_db.get_table(table_name, schema=schema).columns
 
         if show_cols:
-            fields = [my_db.get_quoter()(c.name) for c in cols]
+            fields = [my_db.get_quoter()(c.get('name')) for c in cols]
 
 Review comment:
   Good catch, turns out I had inconsistent ways to get the column information 
here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to