Vitor-Avila commented on code in PR #44992:
URL: https://github.com/apache/superset/pull/44992#discussion_r4213564858
##########
superset/commands/security/reset.py:
##########
@@ -62,7 +63,10 @@ def run(self) -> None:
db.session.delete(database)
db.session.query(Dashboard).delete()
db.session.query(Slice).delete()
- db.session.query(KeyValueEntry).delete()
+ config_uuid = FIXED_RESOURCE_KEYS[KeyValueResource.ALERT_REPORT_CONFIG]
+ db.session.query(KeyValueEntry).filter(
+ KeyValueEntry.uuid.is_(None) | (KeyValueEntry.uuid != config_uuid)
+ ).delete()
Review Comment:
The `ENABLE_FACTORY_RESET_COMMAND` clears the `key_value` table. Updated the
logic to preserve these configuration (as the command typically wouldn't impact
them).
I included `KeyValueEntry.uuid.is_(None)` just because technically `UUID` is
`nullable=False`, so in the event there are entries without a UUID value, it
would be deleted before, so deleting it here for consistency.
--
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]