diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py index b063b67ee8323..ca955a7c8dcaf 100644 --- a/superset/connectors/druid/models.py +++ b/superset/connectors/druid/models.py @@ -331,6 +331,11 @@ class DruidDatasource(Model, BaseDatasource): 'datasource_name', 'is_hidden', 'description', 'default_endpoint', 'cluster_name', 'offset', 'cache_timeout', 'params' ) + slices = relationship( + 'Slice', + primaryjoin=( + "DruidDatasource.id == foreign(Slice.datasource_id) and " + "Slice.datasource_type == 'druid'")) @property def database(self): diff --git a/superset/connectors/druid/views.py b/superset/connectors/druid/views.py index bfd13df5cd00c..68047dd05de75 100644 --- a/superset/connectors/druid/views.py +++ b/superset/connectors/druid/views.py @@ -155,7 +155,7 @@ class DruidDatasourceModelView(SupersetModelView, DeleteMixin): # noqa 'datasource_link', 'changed_on_', 'offset'] related_views = [DruidColumnInlineView, DruidMetricInlineView] edit_columns = [ - 'datasource_name', 'cluster', 'description', 'owner', + 'datasource_name', 'cluster', 'slices', 'description', 'owner', 'is_hidden', 'filter_select_enabled', 'fetch_values_from', 'default_endpoint', 'offset', 'cache_timeout'] @@ -164,6 +164,14 @@ class DruidDatasourceModelView(SupersetModelView, DeleteMixin): # noqa page_size = 500 base_order = ('datasource_name', 'asc') description_columns = { + 'slices': _( + "The list of slices associated with this table. By " + "altering this datasource, you may change how these associated " + "slices behave. " + "Also note that slices need to point to a datasource, so " + "this form will fail at saving if removing slices from a " + "datasource. If you want to change the datasource for a slice, " + "overwrite the slice from the 'explore view'"), 'offset': _("Timezone offset (in hours) for this datasource"), 'description': Markup( "Supports