bito-code-review[bot] commented on PR #40443:
URL: https://github.com/apache/superset/pull/40443#issuecomment-4545041214
<!-- Bito Reply -->
The PR comment indicates that the current implementation treats all
non-PostgreSQL dialects as SQLite, leading to SQLite-specific `ON CONFLICT`
statements being executed on MySQL/MariaDB databases, which causes failures.
The suggested fix is to explicitly branch on the actual dialect (e.g., handle
"postgresql" and "sqlite" separately) and use a dialect-agnostic insert+update
sequence for others. This will ensure compatibility with MySQL/MariaDB as well
as PostgreSQL and SQLite.
To implement this fix, you can modify the code in
`superset/extensions/settings.py` to include a check for the dialect and handle
it accordingly. Here's a suggested approach:
1. Identify the current code that handles the upsert logic.
2. Add a conditional check to determine the dialect.
3. For PostgreSQL and SQLite, use the existing logic.
4. For other dialects, implement a generic insert+update sequence that is
compatible with MySQL/MariaDB.
This approach will ensure that the upsert operations are correctly handled
for different database dialects.
**superset/extensions/settings.py**
```
def _upsert_settings_row(session, extension_id, settings):
dialect = session.bind.dialect
if dialect.name == 'postgresql':
# PostgreSQL-specific logic
pass
elif dialect.name == 'sqlite':
# SQLite-specific logic
pass
else:
# Generic logic for other dialects
pass
```
--
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]