superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [incubator-superset] branch master updated: Avoid expensive select_star on dashboard bootstrap data (#5424)
Date Wed, 18 Jul 2018 22:54:50 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository

The following commit(s) were added to refs/heads/master by this push:
     new 5be0e69  Avoid expensive select_star on dashboard bootstrap data (#5424)
5be0e69 is described below

commit 5be0e69d1b848dd7ea13f3adc883146484e9ba6a
Author: Maxime Beauchemin <>
AuthorDate: Wed Jul 18 15:54:47 2018 -0700

    Avoid expensive select_star on dashboard bootstrap data (#5424)
    The dashboard page bootstrap data currently attempts to generate the
    `SELECT` statement with column name details for each table represented
    in the dash. This means it calls the database(s) and waits for column
    details prior to returning any HTML.
    This makes the default select_star property generate a simple
    `SELECT *` with no column details instead, which doesn't require
    interogating the DBs.
 superset/connectors/sqla/ | 5 ++++-
 superset/data/          | 2 +-
 superset/models/            | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/superset/connectors/sqla/ b/superset/connectors/sqla/
index 205df32..3c5b18e 100644
--- a/superset/connectors/sqla/
+++ b/superset/connectors/sqla/
@@ -371,7 +371,10 @@ class SqlaTable(Model, BaseDatasource):
     def select_star(self):
-        return self.database.select_star(, 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(
+  , show_cols=False, latest_partition=False)
     def get_col(self, col_name):
         columns = self.columns
diff --git a/superset/data/ b/superset/data/
index 49df42b..5334269 100644
--- a/superset/data/
+++ b/superset/data/
@@ -17,7 +17,7 @@ from sqlalchemy import BigInteger, Date, DateTime, Float, String, Text
 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/ b/superset/models/
index 8c77814..13021e7 100644
--- a/superset/models/
+++ b/superset/models/
@@ -775,7 +775,7 @@ class Database(Model, AuditMixinNullable, ImportMixin):
     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(

View raw message