zephyring commented on code in PR #25043:
URL: https://github.com/apache/superset/pull/25043#discussion_r1302265430
##########
superset/daos/base.py:
##########
@@ -171,10 +171,17 @@ def update(cls, model: T, properties: dict[str, Any],
commit: bool = True) -> T:
Generic update a model
:raises: DAOCreateFailedError
"""
+ d = dict(model.__dict__)
+ d.pop("_sa_instance_state") # get rid of SQLAlchemy special attr
+ copy = model.__class__(**d)
+ copy.id = model.id
+ # create a copy of the model here
+ # so it doesn't trigger before_update/after_update sqla listener each
time
+ # we set a property
Review Comment:
there's one test `test_run_sync_query_dont_exist` that I cannot get passed
by with this baseDao.update method change(using a copy model instance out of
session and merge)
We probably need more thoughts on how to reduce number of events triggered
on each property update, thus reverting here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]