You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "flwitten (via GitHub)" <gi...@apache.org> on 2026/03/13 10:18:22 UTC
[I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
flwitten opened a new issue, #38629:
URL: https://github.com/apache/superset/issues/38629
### Bug description
# Bug: Deleting a user via the GUI fails with IntegrityError on MariaDB
## Summary
When attempting to delete a user via the Superset Security UI (`Settings → List Users → Delete`), the operation fails silently in the UI with "There was an issue deleting record" and raises an `IntegrityError` in the backend. The user is not deleted. The root cause is that `flask_appbuilder`'s `delete_user()` performs a bare `DELETE FROM ab_user` without cleaning up dependent rows first, and MariaDB foreign keys have no `ON DELETE` rule to handle this automatically.
## Environment
| Component | Version |
|---|---|
| Apache Superset | 6.0.0 |
| flask_appbuilder | ≥ 4.x |
| SQLAlchemy | 2.x |
| Python | 3.11 |
| Database | MariaDB 10.x / 11.x |
> **Note:** PostgreSQL may be unaffected depending on how its FK constraints are created.
## Steps to Reproduce
1. Configure Superset with a MariaDB `SQLALCHEMY_DATABASE_URI`
2. Create at least one non-admin user and have them perform any action (login, view a dashboard, run a query)
3. Navigate to `Settings → Security → List Users`
4. Click the delete icon on any user
5. Observe the error toast: "There was an issue deleting record"
## Error
**UI:** Toast notification: `There was an issue deleting record`
**Backend log:**
```
ERROR:superset.views.base:IntegrityError: (pymysql.err.IntegrityError)
(1451, 'Cannot delete or update a parent row: a foreign key constraint fails
(`superset`.`logs`, CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `ab_user` (`id`))')
```
## Root Cause
`flask_appbuilder`'s `SecurityManager.delete_user()` executes a direct `DELETE FROM ab_user WHERE id = ?` without prior cleanup of dependent rows in tables that reference `ab_user.id`.
Superset's Alembic migrations create these foreign keys **without** any `ON DELETE` rule (defaulting to `RESTRICT` in MariaDB). Affected tables include:
| Table | Column | Expected behavior |
|---|---|---|
| `logs` | `user_id` | `SET NULL` (audit log, keep row) |
| `saved_query` | `user_id` | `SET NULL` (keep query, remove owner) |
| `query` | `user_id` | `SET NULL` |
| `favstar` | `user_id` | `CASCADE` (delete user's favorites) |
| `dashboard_user` | `user_id` | `CASCADE` |
| `slice_user` | `user_id` | `CASCADE` |
| `report_schedule_user` | `user_id` | `CASCADE` |
| `sqlatable_user` | `user_id` | `CASCADE` |
| `tab_state` | `user_id` | `CASCADE` |
| `ab_user_role` | `user_id` | `CASCADE` |
| `ab_user_group` | `user_id` | `CASCADE` |
## Fix
Add proper `ON DELETE` rules to all `user_id` foreign keys. For audit/log tables use `SET NULL` to preserve records; for ownership/membership tables use `CASCADE`:
```sql
-- Example for logs table
ALTER TABLE `logs` DROP FOREIGN KEY `logs_ibfk_1`;
ALTER TABLE `logs` ADD CONSTRAINT `logs_user_fk`
FOREIGN KEY (`user_id`) REFERENCES `ab_user`(`id`) ON DELETE SET NULL;
-- Example for dashboard_user table
ALTER TABLE `dashboard_user` DROP FOREIGN KEY `dashboard_user_ibfk_1`;
ALTER TABLE `dashboard_user` ADD CONSTRAINT `dashboard_user_user_fk`
FOREIGN KEY (`user_id`) REFERENCES `ab_user`(`id`) ON DELETE CASCADE;
```
The correct long-term fix would be either:
- Adding `ON DELETE` rules to the Alembic migration that creates these constraints, or
- Having `flask_appbuilder`'s `delete_user()` clean up dependent rows before deleting the user
## Impact
- User deletion via the GUI is **completely broken** on MariaDB
- Affects all Superset installations using MariaDB where users have any activity (logs, queries, dashboards, etc.)
- PostgreSQL may also be affected depending on FK constraint definitions
### Screenshots/recordings
_No response_
### Superset version
6.0.0
### Python version
3.11
### Node version
Not applicable
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "Ujjwaljain16 (via GitHub)" <gi...@apache.org>.
Ujjwaljain16 commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-6330265828
thanks @rusackas, that's helpful i'll take it on....
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "Ujjwaljain16 (via GitHub) via notifications" <no...@superset.apache.org>.
Ujjwaljain16 commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-6802912354
thanks @rusackas, that makes sense am not trying to make MariaDB a supported metadata database
on scope:
the failure isn't MariaDB-specific i re-checked today on current master (`14365bbe`) with ordinary activity and no hand-made rows: an admin creates a user, that user logs in, creates a dashboard and stars it and the admin deletes them through `DELETE /api/v1/security/users/{id}`, which is what Settings -> List Users calls
a user with no history deletes fine the user who created the dashboard gets HTTP 422 and is not deleted on both PostgreSQL 16 (`dashboards_created_by_fk_fkey`) and MySQL 8.0 (`dashboards_ibfk_1`)
the proof of concept branch fixes this in application code, with no migration and no schema or api change so it should behave the same on any metadata DB with it the same scenario deletes both users on PostgreSQL and MySQL
i havve only tested those two not MariaDB, and i won't claim MariaDB support
Branch (rebased on current master): https://github.com/Ujjwaljain16/superset/tree/fix/user-delete-policy
Policy discussion on dev@ (no replies yet): https://lists.apache.org/thread/tgqnjlh38z0y493hfklrbkb7rnrn352x
Since yr comment points at the base use case, which would you prefer?
(a) I keep this issue and re-scope its title to PostgreSQL/MySQL, or
(b) I file a fresh issue for the PostgreSQL/MySQL case and have the PR reference that leaving this one for the MariaDB question.
i will open a draft PR from the branch either way.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-6423741766
I should have pointed out something earlier here that makes this issue a little unusual.
MariaDB is NOT a supported metadata database. [Officially](https://superset.apache.org/admin-docs/configuration/configuring-superset/#setting-up-a-production-metadata-database) we support Postgres and MySQL.
So, on one hand I want to simply close this with the ol' "not supported" rationale, and say "we're open to improvements"
But, if things need to be restructured significantly to make MariaDB work, and support it, I'd also want docs added on that link, and testing to make it as comprehensively supported as possible, since we'd be taking it on as a maintenance burden, and would want a pattern for other DBs to follow.
So, I guess... I'm feeing open to non-breaking improvements/fixes that support the base use case and _happen_ to make things better for MariaDB, but if the goal here is to make MariaDB stable/supported, that's a different discussion, and probably not a huge priority for maintainers in general.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "hannespr (via GitHub)" <gi...@apache.org>.
hannespr commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4932673568
I just experienced the same problem with a PostgreSQL DB & v6.1.0.
```
superset-1 | Traceback (most recent call last):
superset-1 | File "/app/.venv/lib/python3.11/site-packages/flask_appbuilder/models/sqla/interface.py", line 831, in delete
superset-1 | self.session.commit()
superset-1 | File "<string>", line 2, in commit
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1454, in commit
superset-1 | self._transaction.commit(_to_root=self.future)
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 832, in commit
superset-1 | self._prepare_impl()
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl
superset-1 | self.session.flush()
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
superset-1 | self._flush(objects)
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3588, in _flush
superset-1 | with util.safe_reraise():
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
superset-1 | compat.raise_(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
superset-1 | raise exception
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
superset-1 | flush_context.execute()
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
superset-1 | rec.execute(self)
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 667, in execute
superset-1 | util.preloaded.orm_persistence.delete_obj(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 343, in delete_obj
superset-1 | _emit_delete_statements(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 1468, in _emit_delete_statements
superset-1 | c = connection._execute_20(
superset-1 | ^^^^^^^^^^^^^^^^^^^^^^^
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
superset-1 | return meth(self, args_10style, kwargs_10style, execution_options)
superset-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
superset-1 | return connection._execute_clauseelement(
superset-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
superset-1 | ret = self._execute_context(
superset-1 | ^^^^^^^^^^^^^^^^^^^^^^
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
superset-1 | self._handle_dbapi_exception(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
superset-1 | util.raise_(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
superset-1 | raise exception
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
superset-1 | self.dialect.do_execute(
superset-1 | File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
superset-1 | cursor.execute(statement, parameters)
superset-1 | sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "ab_user" violates foreign key constraint "key_value_created_by_fk_fkey" on table "key_value"
superset-1 | DETAIL: Key (id)=(3) is still referenced from table "key_value".
superset-1 |
superset-1 | [SQL: DELETE FROM ab_user WHERE ab_user.id = %(id)s]
superset-1 | [parameters: {'id': 3}]
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "fowlerp397-tech (via GitHub)" <gi...@apache.org>.
fowlerp397-tech commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4073748447
Can you check if this still happens on the latest version?
On Mon, Mar 16, 2026, 12:18 PM Evan Rusackas ***@***.***>
wrote:
> *rusackas* left a comment (apache/superset#38629)
> <https://github.com/apache/superset/issues/38629#issuecomment-4069294890>
>
> Right now, we support MySQL and PostgreSQL as the official metadata
> databases.
>
> I'd love to see MariaDB supported officially, if you want to take this
> (and perhaps some docs updates) under your wing, and/or open a SIP.
>
> Relevant docs:
>
> https://superset.apache.org/admin-docs/configuration/configuring-superset#setting-up-a-production-metadata-database
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/superset/issues/38629#issuecomment-4069294890>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/B72HASLQ2GGDV56H72UK7HL4RAZOJAVCNFSM6AAAAACWQZIGROVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANRZGI4TIOBZGA>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-6328472283
Thanks for digging into this. I like the per-category policy idea, and I'd lean toward the application-level route through `UserDAO.delete` over a migration touching every FK. A [DISCUSS] thread on dev@ sounds like the right place to hash it out (to at least decide if a SIP is needed or not), and I don't know of anyone else working on it, so its yours to "own" if you'd like to open up a POC (draft PR) as part of the backing for that discussion.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "Abdulrehman-PIAIC80387 (via GitHub)" <gi...@apache.org>.
Abdulrehman-PIAIC80387 commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4955818512
Picking this up. Confirmed on PostgreSQL 6.1.0 too, not just MariaDB.
Fix approach: add `ON DELETE SET NULL` on audit FKs (`created_by_fk`, `changed_by_fk`, `logs.user_id`, etc.) and `ON DELETE CASCADE` on ownership FKs (`favstar`, `user_attribute`, `tab_state`) — at both the model layer and via an Alembic migration. Same pattern as `6d05b0a70c89` (2023) and `32bf93dfe2a4` (2025).
Verified end-to-end on Postgres. Regression test included. PR incoming.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "Ujjwaljain16 (via GitHub)" <gi...@apache.org>.
Ujjwaljain16 commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-5992756721
Hi all, I'd like to pick this up. Here's what I found first, so we don't repeat earlier work.
**Previous attempt**
#41994 tried to fix this with `ON DELETE` rules on the `ab_user` foreign keys. @michael-s-molina asked for a SIP before any code, since tables like `logs` and `saved_query` can't all simply be set to NULL. The author narrowed the scope, but @rusackas still wanted sign-off on the SET NULL vs CASCADE semantics. The migration also had a `down_revision` clash. The author closed it on 2026-08-28 and said they'd revisit once a SIP existed. They also noted that a DB-level cascade on `favstar` bypasses `FavStarUpdater.after_delete`, so tagging data would leak.
**Not MariaDB-specific**
It also reproduces on PostgreSQL. @gdudau and @hannespr (6.1.0) both hit `key_value_created_by_fk_fkey` violations when deleting a user.
**Still present on master (`7a2913e2db`)**
These `ab_user` foreign keys declare no `ondelete`:
- `logs.user_id`
- `favstar.user_id`
- `key_value.created_by_fk` / `changed_by_fk`
- `query.user_id`
- `saved_query.user_id`
- `tab_state.user_id`
- `user_attribute.user_id`
- `user_favorite_tag.user_id`
- `slices.last_saved_by_fk`
- `created_by_fk` / `changed_by_fk` from `AuditMixinNullable`, which is used by many models
Newer tables already declare `ondelete="CASCADE"` on `ab_user.id`: `database_user_oauth2_tokens`, `task_subscribers`, the extension storage table and `subjects`. So the codebase is already moving in that direction for user-scoped data, but the older tables above were never covered.
**Existing SIP/discussion**
I couldn't find a SIP or discussion that decides this. #39464 (SIP-208) is soft delete for charts, dashboards and datasets, which is a different topic. The problem has come up repeatedly: #8752, #13345, #29512 and discussion #40137.
**Proposal**
I'd like to write a SIP that decides the policy per category of data:
- audit data: keep the row, clear the user
- personal state: delete with the user
- authored or owned content: reassign to a chosen user, or refuse with a clear error instead of an IntegrityError
It would also compare doing this at the DB level with doing it in the application. Superset already has `UserDAO.delete`, which does custom cleanup (`_delete_subject`) before delegating to the base delete. That might be a natural place for the application-level option and would avoid a migration across all these constraints.
@michael-s-molina @rusackas does this direction sound right? If someone is already working on it, tell me and I'll help there instead. Otherwise I'll start a `[DISCUSS]` thread on dev@ once I have a draft.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4054092386
<!-- Answer -->
This is a known issue. Some migrations were added in 2023 to address this partially, but several tables were missed:
**Tables with ON DELETE CASCADE (already fixed):**
- [`dashboard_user`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py), [`slice_user`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py), [`report_schedule_user`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py), [`sqlatable_user`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-06-22_13-39_6fbe660cac39_add_on_delete_cascade_for_tables_references.py)
**Tables still missing ON DELETE rules (as you identified):**
- `logs`, `saved_query`, `query`, `favstar`, `tab_state`
There's an [open PR #36342](https://github.com/apache/superset/pull/36342) that aims to address user deletion more comprehensively with FK constraint modifications and support for asset reassignment before deletion. This would be the proper long-term fix.
Your analysis and proposed fix align well with what's been discussed in [previous discussions](https://github.com/apache/superset/discussions/34648#discussioncomment-14077870). For the `logs` table specifically, `SET NULL` is the right approach since [deleting logs would remove audit history](https://github.com/apache/superset/discussions/34648#discussioncomment-14077870), which may have compliance implications.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a0c8e541-984a
-4f7c-b6cc-e78a9e39ed3d?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report) | [Other](https://app.dosu.dev/response-feedback/a0c8e541-984a-4f7c-b6cc-e78a9e39ed3d?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20issue.%20Some%20migrations%20were%20added%20in%202023%20to%20address%20this%20partially%2C%20but%20several%20tables%20were%20missed%3A%0A%0A%2A%2ATables%20with%20ON%20DELETE%20CASCADE%20%28already%20fixed%29%3A%2A%2A%0A-%20%5B%60dashboard_user%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py%29%2C%20%5B%60slice_user%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_reference
s.py%29%2C%20%5B%60report_schedule_user%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-07-11_15-51_6d05b0a70c89_add_on_delete_cascade_for_owners_references.py%29%2C%20%5B%60sqlatable_user%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2023-06-22_13-39_6fbe660cac39_add_on_delete_cascade_for_tables_references.py%29%0A%0A%2A%2ATables%20still%20missing%20ON%20DELETE%20rules%20%28as%20you%20identified%29%3A%2A%2A%0A-%20%60logs%60%2C%20%60saved_query%60%2C%20%60query%60%2C%20%60favstar%60%2C%20%60tab_state%60%0A%0AThere%27s%20an%20%5Bopen%20PR%20%2336342%5D%28https%3A//github.com/apache/superset/pull/36342%29%20that%20aims%20to%20address%20user%20deletion%20more%20comprehensively%20with%20FK%20constraint%20modifications%20and%20support%20for%20asset%20reassignment%20before%20deletion.%20This%20would%20be%20the%20proper%20long-term%20fix.%0A
%0AYour%20analysis%20and%20proposed%20fix%20align%20well%20with%20what%27s%20been%20discussed%20in%20%5Bprevious%20discussions%5D%28https%3A//github.com/apache/superset/discussions/34648%23discussioncomment-14077870%29.%20For%20the%20%60logs%60%20table%20specifically%2C%20%60SET%20NULL%60%20is%20the%20right%20approach%20since%20%5Bdeleting%20logs%20would%20remove%20audit%20history%5D%28https%3A//github.com/apache/superset/discussions/34648%23discussioncomment-14077870%29%2C%20which%20may%20have%20compliance%20implications.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/38629)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "gdudau (via GitHub)" <gi...@apache.org>.
gdudau commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4427662993
I have same error on PostgreSQL when I try to delete an user.
`2026-05-12 08:28:30,693:ERROR:flask_appbuilder.models.sqla.interface:Delete item database error
Traceback (most recent call last):
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.ForeignKeyViolation: update or delete on table "ab_user" violates foreign key constraint "key_value_created_by_fk_fkey" on table "key_value"
DETAIL: Key (id)=(2) is still referenced from table "key_value".
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "superset/.venv/lib64/python3.10/site-packages/flask_appbuilder/models/sqla/interface.py", line 831, in delete
self.session.commit()
File "<string>", line 2, in commit
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 1454, in commit
self._transaction.commit(_to_root=self.future)
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 832, in commit
self._prepare_impl()
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl
self.session.flush()
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 3449, in flush
self._flush(objects)
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 3588, in _flush
with util.safe_reraise():
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
compat.raise_(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush
flush_context.execute()
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 453, in execute
n.execute_aggregate(self, set_)
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 776, in execute_aggregate
persistence.delete_obj(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 343, in delete_obj
_emit_delete_statements(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 1468, in _emit_delete_statements
c = connection._execute_20(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
ret = self._execute_context(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
self._handle_dbapi_exception(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
util.raise_(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "superset/.venv/lib64/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "ab_user" violates foreign key constraint "key_value_created_by_fk_fkey" on table "key_value"
DETAIL: Key (id)=(2) is still referenced from table "key_value".
[SQL: DELETE FROM ab_user WHERE ab_user.id = %(id)s]
[parameters: {'id': 2}]
(Background on this error at: https://sqlalche.me/e/14/gkpj)`
I don't have charts or dashboards.
PostgreSQL is not in supported versions: 18.3
Apache Superset version 6.0.0
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4069294890
Right now, we support MySQL and PostgreSQL as the official metadata databases.
I'd love to see MariaDB supported officially, if you want to take this (and perhaps some docs updates) under your wing, and/or open a SIP.
Relevant docs:
https://superset.apache.org/admin-docs/configuration/configuring-superset#setting-up-a-production-metadata-database
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "flwitten (via GitHub)" <gi...@apache.org>.
flwitten commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-4089589582
@rusackas I'll move to MySQL as I cannot use any unsupported db as superset metadb
@fowlerp397-tech haven't upgraded as there is no stable later than 6.0.0, I cannot use rc in a production environment, have to validate in my lab
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] 6.0.0 - Deleting a user via the GUI fails with IntegrityError on MariaDB [superset]
Posted by "Ujjwaljain16 (via GitHub) via notifications" <no...@superset.apache.org>.
Ujjwaljain16 commented on issue #38629:
URL: https://github.com/apache/superset/issues/38629#issuecomment-6803544695
opened a draft PR from the branch as a proof of concept for the policy discussion: https://github.com/apache/superset/pull/46163
its rebased on current master and has the open questions (saved queries, content whose only editor is deleted, the legacy `/users/delete` view) listed at the top
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org