Skip to content

Commit

Permalink
[hotfix] delete DAR when datasource requested does not exist anymore (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vera-liu authored Jan 25, 2017
1 parent 1f2126f commit 5715f52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion superset/source_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_datasource(cls, datasource_type, datasource_id, session):
return (
session.query(cls.sources[datasource_type])
.filter_by(id=datasource_id)
.one()
.first()
)

@classmethod
Expand Down
4 changes: 3 additions & 1 deletion superset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,9 @@ def clean_fulfilled_requests(session):
datasource = SourceRegistry.get_datasource(
r.datasource_type, r.datasource_id, session)
user = sm.get_user_by_id(r.created_by_fk)
if self.datasource_access(datasource, user):
if not datasource or \
self.datasource_access(datasource, user):
# datasource doesnot exist anymore
session.delete(r)
session.commit()
datasource_type = request.args.get('datasource_type')
Expand Down

0 comments on commit 5715f52

Please sign in to comment.