fix(dashboard): commit update once (#17781)
This commit is contained in:
parent
bcd698d999
commit
3657cbea7f
|
|
@ -34,6 +34,7 @@ from superset.dashboards.commands.exceptions import (
|
|||
)
|
||||
from superset.dashboards.dao import DashboardDAO
|
||||
from superset.exceptions import SupersetSecurityException
|
||||
from superset.extensions import db
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.views.base import check_ownership
|
||||
|
||||
|
|
@ -51,13 +52,14 @@ class UpdateDashboardCommand(UpdateMixin, BaseCommand):
|
|||
self.validate()
|
||||
try:
|
||||
dashboard = DashboardDAO.update(self._model, self._properties, commit=False)
|
||||
dashboard = DashboardDAO.update_charts_owners(dashboard, commit=True)
|
||||
dashboard = DashboardDAO.update_charts_owners(dashboard, commit=False)
|
||||
if self._properties.get("json_metadata"):
|
||||
dashboard = DashboardDAO.set_dash_metadata(
|
||||
dashboard,
|
||||
data=json.loads(self._properties.get("json_metadata", "{}")),
|
||||
commit=True,
|
||||
commit=False,
|
||||
)
|
||||
db.session.commit()
|
||||
except DAOUpdateFailedError as ex:
|
||||
logger.exception(ex.exception)
|
||||
raise DashboardUpdateFailedError() from ex
|
||||
|
|
|
|||
Loading…
Reference in New Issue