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

fix: dashboard cache invalid join query #11369

Merged
merged 2 commits into from
Oct 22, 2020
Merged
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ def clear_cache_for_datasource(cls, datasource_id: int) -> None:
[dashboard_slices.c.dashboard_id], distinct=True,
).select_from(
join(
Slice,
dashboard_slices,
Slice.id == dashboard_slices.c.slice_id,
Slice.datasource_id == datasource_id,
Slice,
(Slice.id == dashboard_slices.c.slice_id)
& (Slice.datasource_id == datasource_id),
Comment on lines +317 to +318
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this could be expressed as and_(Slice.id == dashboard_slices.c.slice_id, Slice.datasource_id == datasource_id)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I kind of like the bit operator better..

)
)
for (dashboard_id,) in db.session.execute(filter_query):
Expand Down Expand Up @@ -598,7 +598,7 @@ def clear_dashboard_cache(
sqla.event.listen(Slice, "after_update", clear_dashboard_cache)
sqla.event.listen(Slice, "after_delete", clear_dashboard_cache)
sqla.event.listen(
BaseDatasource, "after_update", clear_dashboard_cache, propagage=True
BaseDatasource, "after_update", clear_dashboard_cache, propagate=True
)
# also clear cache on column/metric updates since updates to these will not
# trigger update events for BaseDatasource.
Expand Down