Skip to content

Commit

Permalink
fix(dashboard): commit update once (apache#17781)
Browse files Browse the repository at this point in the history
  • Loading branch information
serenajiang authored and bwang221 committed Feb 10, 2022
1 parent 9915df0 commit 246b231
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions superset/dashboards/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
)
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

Expand All @@ -51,13 +52,14 @@ def run(self) -> Model:
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
Expand Down

0 comments on commit 246b231

Please sign in to comment.