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: Update exception for DatasourceNotFound from DatasourceDao.get_datasource() #21217

Merged
merged 2 commits into from
Aug 26, 2022
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
1 change: 1 addition & 0 deletions superset/dao/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ class DatasourceTypeNotSupportedError(DAOException):


class DatasourceNotFound(DAOException):
status = 404
message = "Datasource does not exist"
4 changes: 2 additions & 2 deletions superset/explore/commands/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from superset.commands.base import BaseCommand
from superset.connectors.base.models import BaseDatasource
from superset.connectors.sqla.models import SqlaTable
from superset.datasets.commands.exceptions import DatasetNotFoundError
from superset.dao.exceptions import DatasourceNotFound
from superset.datasource.dao import DatasourceDAO
from superset.exceptions import SupersetException
from superset.explore.commands.parameters import CommandParameters
Expand Down Expand Up @@ -114,7 +114,7 @@ def run(self) -> Optional[Dict[str, Any]]:
dataset = DatasourceDAO.get_datasource(
db.session, cast(str, self._dataset_type), self._dataset_id
)
except DatasetNotFoundError:
except DatasourceNotFound:
pass
dataset_name = dataset.name if dataset else _("[Missing Dataset]")

Expand Down