Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid expensive select_star on dashboard bootstrap data #5424

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion superset/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion superset/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down