Arunodoy18 opened a new pull request, #37547:
URL: https://github.com/apache/superset/pull/37547
### SUMMARY
Fixes CSV import failures on MySQL databases that enforce primary keys
(e.g. when `sql_require_primary_key = ON`).
When importing a CSV, Superset generates a CREATE TABLE statement without
a primary key. Databases that require primary keys correctly reject this
operation. This change detects when a primary key is required and
automatically adds a safe auto-increment primary key during table creation,
while preserving existing behavior for databases that do not enforce this
constraint.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable.
### TESTING INSTRUCTIONS
**Automated testing:**
- Added integration tests covering:
- Detection of MySQL primary key requirement
- Automatic primary key addition during CSV import when required
- Skipping primary key addition when not required
- Error-handling behavior for detection failures
**Manual testing (optional):**
1. Configure a MySQL database with `sql_require_primary_key = ON`
2. Import a CSV file using Superset
3. Verify that the table is created successfully with an auto-increment
primary key
4. Confirm existing CSV import behavior remains unchanged for databases
without this requirement
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #37399
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]