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: datasourcedao datasource not found error #20725

Merged
merged 6 commits into from
Jul 19, 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
8 changes: 8 additions & 0 deletions superset/datasource/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

import logging
from typing import Dict, Type, Union

from sqlalchemy.orm import Session
Expand All @@ -27,6 +28,8 @@
from superset.tables.models import Table
from superset.utils.core import DatasourceType

logger = logging.getLogger(__name__)

Datasource = Union[Dataset, SqlaTable, Table, Query, SavedQuery]


Expand Down Expand Up @@ -57,6 +60,11 @@ def get_datasource(
)

if not datasource:
logger.warning(
"Datasource not found datasource_type: %s, datasource_id: %s",
datasource_type,
datasource_id,
)
raise DatasourceNotFound()

return datasource
2 changes: 1 addition & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def explore(
try:
datasource = DatasourceDAO.get_datasource(
db.session,
DatasourceType(cast(str, datasource_type)),
DatasourceType("table"),
Copy link
Member

Choose a reason for hiding this comment

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

@hughhhh @pkdotson I see that this endpoint is deprecated but why are we only using table here?

datasource_id,
)
except DatasetNotFoundError:
Expand Down