mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: datasourcedao datasource not found error (#20725)
* first fix * remove prints * run pc * fix linter * commit
This commit is contained in:
committed by
GitHub
parent
84d4302628
commit
1d9d505a6e
@@ -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
|
||||
@@ -27,6 +28,8 @@ from superset.models.sql_lab import Query, SavedQuery
|
||||
from superset.tables.models import Table
|
||||
from superset.utils.core import DatasourceType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
Datasource = Union[Dataset, SqlaTable, Table, Query, SavedQuery]
|
||||
|
||||
|
||||
@@ -57,6 +60,11 @@ class DatasourceDAO(BaseDAO):
|
||||
)
|
||||
|
||||
if not datasource:
|
||||
logger.warning(
|
||||
"Datasource not found datasource_type: %s, datasource_id: %s",
|
||||
datasource_type,
|
||||
datasource_id,
|
||||
)
|
||||
raise DatasourceNotFound()
|
||||
|
||||
return datasource
|
||||
|
||||
Reference in New Issue
Block a user