refactor: Ensure Flask framework leverages the Flask-SQLAlchemy session (#26200)

This commit is contained in:
John Bodley
2024-01-18 08:27:29 +13:00
committed by GitHub
parent 80a6e25a98
commit df79522160
26 changed files with 314 additions and 388 deletions

View File

@@ -18,7 +18,7 @@ import logging
from flask_appbuilder.api import expose, protect, safe
from superset import app, db, event_logger
from superset import app, event_logger
from superset.daos.datasource import DatasourceDAO
from superset.daos.exceptions import DatasourceNotFound, DatasourceTypeNotSupportedError
from superset.exceptions import SupersetSecurityException
@@ -100,7 +100,7 @@ class DatasourceRestApi(BaseSupersetApi):
"""
try:
datasource = DatasourceDAO.get_datasource(
db.session, DatasourceType(datasource_type), datasource_id
DatasourceType(datasource_type), datasource_id
)
datasource.raise_for_access()
except ValueError: