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

Speed up all CRUD list views #2747

Merged
merged 1 commit into from
May 11, 2017
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
6 changes: 5 additions & 1 deletion superset/connectors/druid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class DruidClusterModelView(SupersetModelView, DeleteMixin): # noqa
]
edit_columns = add_columns
list_columns = ['cluster_name', 'metadata_last_refreshed']
search_columns = ('cluster_name',)
label_columns = {
'cluster_name': _("Cluster"),
'coordinator_host': _("Coordinator Host"),
Expand Down Expand Up @@ -150,7 +151,7 @@ class DruidDatasourceModelView(SupersetModelView, DeleteMixin): # noqa
datamodel = SQLAInterface(models.DruidDatasource)
list_widget = ListWidgetWithCheckboxes
list_columns = [
'datasource_link', 'cluster', 'changed_by_', 'changed_on_', 'offset']
'datasource_link', 'cluster', 'changed_by_', 'modified']
order_columns = [
'datasource_link', 'changed_on_', 'offset']
related_views = [DruidColumnInlineView, DruidMetricInlineView]
Expand All @@ -159,6 +160,9 @@ class DruidDatasourceModelView(SupersetModelView, DeleteMixin): # noqa
'is_hidden',
'filter_select_enabled', 'fetch_values_from',
'default_endpoint', 'offset', 'cache_timeout']
search_columns = (
'datasource_name', 'cluster', 'description', 'owner'
)
add_columns = edit_columns
show_columns = add_columns + ['perm']
page_size = 500
Expand Down
5 changes: 4 additions & 1 deletion superset/connectors/sqla/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class TableModelView(SupersetModelView, DeleteMixin): # noqa
datamodel = SQLAInterface(models.SqlaTable)
list_columns = [
'link', 'database',
'changed_by_', 'changed_on_']
'changed_by_', 'modified']
order_columns = [
'link', 'database', 'changed_on_']
add_columns = ['database', 'schema', 'table_name']
Expand All @@ -149,6 +149,9 @@ class TableModelView(SupersetModelView, DeleteMixin): # noqa
show_columns = edit_columns + ['perm']
related_views = [TableColumnInlineView, SqlMetricInlineView]
base_order = ('changed_on', 'desc')
search_columns = (
'database', 'schema', 'table_name', 'owner',
)
description_columns = {
'slices': _(
"The list of slices associated with this table. By "
Expand Down
2 changes: 1 addition & 1 deletion superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def accessible_by_user(self, database, datasource_names, schema=None):


class SupersetModelView(ModelView):
page_size = 500
page_size = 100


class ListWidgetWithCheckboxes(ListWidget):
Expand Down
8 changes: 7 additions & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ class DatabaseView(SupersetModelView, DeleteMixin): # noqa
'database_name', 'sqlalchemy_uri', 'cache_timeout', 'extra',
'expose_in_sqllab', 'allow_run_sync', 'allow_run_async',
'allow_ctas', 'allow_dml', 'force_ctas_schema']
search_exclude_columns = ('password',)
search_exclude_columns = (
'password', 'tables', 'created_by', 'changed_by', 'queries',
'saved_queries', )
edit_columns = add_columns
show_columns = [
'tables',
Expand Down Expand Up @@ -317,6 +319,9 @@ class SliceModelView(SupersetModelView, DeleteMixin): # noqa
label_columns = {
'datasource_link': 'Datasource',
}
search_columns = (
'slice_name', 'description', 'viz_type', 'owners',
)
list_columns = [
'slice_link', 'viz_type', 'datasource_link', 'creator', 'modified']
edit_columns = [
Expand Down Expand Up @@ -405,6 +410,7 @@ class DashboardModelView(SupersetModelView, DeleteMixin): # noqa
'dashboard_title', 'slug', 'slices', 'owners', 'position_json', 'css',
'json_metadata']
show_columns = edit_columns + ['table_names']
search_columns = ('dashboard_title', 'slug', 'owners')
add_columns = edit_columns
base_order = ('changed_on', 'desc')
description_columns = {
Expand Down
1 change: 1 addition & 0 deletions superset/views/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SavedQueryView(SupersetModelView, DeleteMixin):
show_columns = [
'id', 'label', 'user', 'database',
'description', 'sql', 'pop_tab_link']
search_columns = ('label', 'user', 'database', 'schema', 'changed_on')
add_columns = ['label', 'database', 'description', 'sql']
edit_columns = add_columns
base_order = ('changed_on', 'desc')
Expand Down