You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/18 22:54:49 UTC

[GitHub] mistercrunch closed pull request #5424: Avoid expensive select_star on dashboard bootstrap data

mistercrunch closed pull request #5424: Avoid expensive select_star on dashboard bootstrap data
URL: https://github.com/apache/incubator-superset/pull/5424
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 205df32b09..3c5b18ea99 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -371,7 +371,10 @@ def time_column_grains(self):
 
     @property
     def select_star(self):
-        return self.database.select_star(self.name, show_cols=True)
+        # show_cols and latest_partition set to false to avoid
+        # the expensive cost of inspecting the DB
+        return self.database.select_star(
+            self.name, show_cols=False, latest_partition=False)
 
     def get_col(self, col_name):
         columns = self.columns
diff --git a/superset/data/__init__.py b/superset/data/__init__.py
index 49df42b137..5334269552 100644
--- a/superset/data/__init__.py
+++ b/superset/data/__init__.py
@@ -17,7 +17,7 @@
 import geohash
 import polyline
 
-from superset import app, db, security_manager, utils
+from superset import app, db, utils
 from superset.connectors.connector_registry import ConnectorRegistry
 from superset.connectors.sqla.models import TableColumn
 from superset.models import core as models
diff --git a/superset/models/core.py b/superset/models/core.py
index 8c77814a2c..13021e7dba 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -775,7 +775,7 @@ def compile_sqla_query(self, qry, schema=None):
 
     def select_star(
             self, table_name, schema=None, limit=100, show_cols=False,
-            indent=True, latest_partition=True, cols=None):
+            indent=True, latest_partition=False, cols=None):
         """Generates a ``select *`` statement in the proper dialect"""
         eng = self.get_sqla_engine(schema=schema)
         return self.db_engine_spec.select_star(


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org