Skip to content
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

chore: refactor file upload commands #28164

Merged
merged 5 commits into from
Apr 23, 2024
Merged

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Apr 20, 2024

SUMMARY

Small refactor on CSVImportCommand and ExcelImportCommand to DRY and make it more easily extendable and maintainable.

Using dependency injection on a generic UploadCommand of BaseReaders that will be able to read a certain type of file.
Pandas lib is able to read from multiple file types, CSV, HTML, Excel, XML, Latex, Feather, SAS XPORT etc. So with this refactor it will be much simpler and clean to add support for new file types.

Also this PR fixes the following bugs on reader options:

  • overrite_duplicates: was an existing option that wasn't actually implemented, removed since I found no option for it on pandas read_csv
  • decimal: was not actually implemented

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@github-actions github-actions bot added the api Related to the REST API label Apr 20, 2024
"description": "If duplicate columns are not overridden,"
"they will be presented as 'X.1, X.2 ...X.x'."
}
)
Copy link
Member

@eschutho eschutho Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpgaspar will this break an existing api integration if someone is passing this field? Should we deprecate it instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was only used on the new API introduced here: #27840
so this API was not yet released

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left one comment but it looks great!

@dpgaspar dpgaspar merged commit de82d90 into apache:master Apr 23, 2024
31 of 33 checks passed
@dpgaspar dpgaspar deleted the fix/file-upload branch April 23, 2024 07:42
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 28, 2024
jzhao62 pushed a commit to jzhao62/superset that referenced this pull request May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the REST API size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants