Skip to content

Commit

Permalink
refactor: remove unnecessary dataset queries from dashboard requests (a…
Browse files Browse the repository at this point in the history
…pache#16110)

* refactor: remove unnecessary dataset queries from dashboard requests

* fix comments
  • Loading branch information
Grace Guo authored Aug 7, 2021
1 parent e7d6274 commit 84330b3
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ fetchMock.get('http://localhost/api/v1/dashboard/26', {
published: false,
roles: [],
slug: null,
table_names:
'[examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines]',
thumbnail_url:
'/api/v1/dashboard/26/thumbnail/b24805e98d90116da8c0974d24f5c533/',
url: '/superset/dashboard/26/',
Expand Down
1 change: 0 additions & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class ChartEntityResponseSchema(Schema):
cache_timeout = fields.Integer(description=cache_timeout_description)
changed_on = fields.String(description=changed_on_description)
modified = fields.String()
datasource = fields.String(description=datasource_name_description)
description = fields.String(description=description_description)
description_markeddown = fields.String(
description=description_markeddown_description
Expand Down
1 change: 0 additions & 1 deletion superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class DashboardGetResponseSchema(Schema):
charts = fields.List(fields.String(description=charts_description))
owners = fields.List(fields.Nested(UserSchema))
roles = fields.List(fields.Nested(RolesSchema))
table_names = fields.String() # legacy nonsense
changed_on_humanized = fields.String(data_key="changed_on_delta_humanized")


Expand Down
5 changes: 0 additions & 5 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ class Dashboard( # pylint: disable=too-many-instance-attributes
def __repr__(self) -> str:
return f"Dashboard<{self.id or self.slug}>"

@property
def table_names(self) -> str:
# pylint: disable=no-member
return ", ".join(str(s.datasource.full_name) for s in self.slices)

@property
def url(self) -> str:
return f"/superset/dashboard/{self.slug or self.id}/"
Expand Down
3 changes: 1 addition & 2 deletions superset/views/dashboard/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
"json_metadata",
"published",
]
show_columns = edit_columns + ["table_names", "charts"]
show_columns = edit_columns + ["charts"]
search_columns = ("dashboard_title", "slug", "owners", "published")
add_columns = edit_columns
base_order = ("changed_on", "desc")
Expand Down Expand Up @@ -87,7 +87,6 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
"position_json": _("Position JSON"),
"css": _("CSS"),
"json_metadata": _("JSON Metadata"),
"table_names": _("Underlying Tables"),
}

def pre_delete(self, item: "DashboardMixin") -> None: # pylint: disable=no-self-use
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/dashboards/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ def test_get_dashboard(self):
"published": False,
"url": "/superset/dashboard/slug1/",
"slug": "slug1",
"table_names": "",
"thumbnail_url": dashboard.thumbnail_url,
}
data = json.loads(rv.data.decode("utf-8"))
Expand Down

0 comments on commit 84330b3

Please sign in to comment.