exemplary-citizen opened a new pull request #16756:
URL: https://github.com/apache/superset/pull/16756
### SUMMARY
```
class CsvToDatabaseForm(DynamicForm):
# pylint: disable=E0211
def csv_allowed_dbs() -> List[Database]: # type: ignore
csv_enabled_dbs = (
db.session.query(Database).filter_by(allow_csv_upload=True).all()
)
return [
csv_enabled_db
for csv_enabled_db in csv_enabled_dbs
if
CsvToDatabaseForm.at_least_one_schema_is_allowed(csv_enabled_db)
]
```
There's unnecessary duplication here between CSV and other forms.
Instead we can abstract this into a class
`UploadToDatabaseForm(DynamicForm)` with all the repeated boilerplate and then
extend those into class `CsvToDatabaseForm(UploadToDatabaseForm)`, class
`ExcelToDatabaseForm(UploadToDatabaseForm)` etc.
### TESTING INSTRUCTIONS
Watch CI and any suggestions from reviewers
### ADDITIONAL INFORMATION
Fixes #16046
- [x] Has associated issue: #16046
- [ ] Required feature flags:
- [ ] Changes UI
- [x] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
cc: @villebro
--
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]