-
Notifications
You must be signed in to change notification settings - Fork 16.6k
fix(db): Add MariaDB DDL fix for NOCYCLE syntax
#37582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(db): Add MariaDB DDL fix for NOCYCLE syntax
#37582
Conversation
Move the MariaDB "NO CYCLE" to "NOCYCLE" DDL fix from migrations/env.py to superset/utils/database.py so it can be properly unit tested. The fix is applied early in the import chain via extensions/__init__.py.
Code Review Agent Run #8ad941Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
All tables are created successfully in MariaDB after this change: |
Code Review Agent Run #398bc1Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
This pull request introduces a fix for a MariaDB-specific DDL syntax issue in Superset by patching SQLAlchemy's sequence creation logic. The main change ensures that when creating sequences for MariaDB, the generated SQL uses
NOCYCLEinstead of the incorrectNO CYCLEsyntax. The fix is applied early in the import chain to guarantee it takes effect throughout the application. Unit tests have also been added to verify the patch works as intended.MariaDB DDL syntax fix:
apply_mariadb_ddl_fix()tosuperset/utils/database.py, which patches SQLAlchemy'sDDLCompiler.visit_create_sequencemethod to replaceNO CYCLEwithNOCYCLEfor MariaDB dialects. This prevents SQL errors when creating sequences in MariaDB.apply_mariadb_ddl_fix()early in thesuperset/extensions/__init__.pyimport chain to ensure the fix is active before any database operations occur.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
tests/unit_tests/utils/test_database.pyto verify that the patch correctly modifies the generated SQL for MariaDB and does not affect other dialects like PostgreSQL.ADDITIONAL INFORMATION