Hi all, A short update, since the PR has had review since my last mail: https://github.com/apache/superset/pull/46163
Where it stands now: - Personal state (favorites, SQL Lab tabs, user attributes, favorite tags) is deleted with the user. - Audit references (created_by/changed_by, logs, query history) are cleared and the rows are kept. - Saved queries are now kept too, with their owner cleared, per Evan's review: a delete is the one outcome we can't undo. Admins with all-query access can still read them; nobody can edit or delete them through the API yet. Still open, with what reviewers have leaned towards so far: 1. Alerts/reports whose only owner is deleted: deactivate them in the same transaction. 2. The legacy /users/delete view: an explicit pre_delete override (vs an ORM before_flush hook that covers every delete path). 3. Owner-less saved queries: leave them read-only for now, or add a way to reassign them? Thanks, Ujjwal On Wed, 11 Nov 2026 at 23:39, Ujjwal Jain <[email protected]> wrote: > Following up on this thread: I opened a draft PR with the proof of concept > so there is something concrete to look at: > > https://github.com/apache/superset/pull/46163 > > It applies the policy in UserDAO (no migration, no schema or API change), > covers the cases discussed above, and lists the open questions in the > description (what to do with a deleted user's saved queries, and with > content whose only editor is deleted). It is a draft and a proof of > concept, not a finished design. > > Feedback on those questions, and on whether this needs a SIP, is very > welcome. > > Thanks, > Ujjwal > > On Mon, 26 Oct 2026 at 01:00, Ujjwal Jain <[email protected]> > wrote: > >> Hi all, >> >> Deleting a user from Settings -> List Users fails with a >> ForeignKeyViolation (HTTP 422) whenever the user has history, on both >> PostgreSQL and MySQL. Details and reproduction: >> https://github.com/apache/superset/issues/38629 >> >> The Delete button works for users with no history, so in practice admins >> deactivate users or edit the metadata DB by hand. A previous fix (#41994) >> was closed after review asked for a policy decision first. >> >> Proposal, discussed with @rusackas <https://github.com/rusackas> on the >> issue: define the behaviour per category of data and enforce it in the >> application (UserDAO), not with ON DELETE rules on ~60 foreign keys. >> >> - personal state (favorites, SQL Lab tabs, user attributes, ...): >> deleted with the user >> - audit columns (created_by/changed_by, logs, key_value): reference >> cleared, rows kept >> - saved queries and content where the user is the only editor: needs >> a decision. Today the ORM deletes a user's saved queries together with the >> user, and a dashboard whose only editor is deleted is left with no >> editors. >> - clearer error that names what blocks the delete >> >> Newer tables (tasks, extension_storage, ...) already follow the audit -> >> SET NULL / personal state -> CASCADE split, so this would extend an >> existing pattern. >> >> Questions for the list: >> >> 1. Does this need a SIP, or is an issue plus PR enough? >> 2. Any objection to the application-level approach over a migration? >> 3. What should happen to saved queries, and to content whose only >> editor is deleted? >> >> A small proof of concept is on a branch here: >> https://github.com/Ujjwaljain16/superset/tree/fix/user-delete-policy >> I'll open a draft PR from it to back the discussion. >> >> Thanks, >> Ujjwal Jain >> >
