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

fix: allow datasource imports on Windows #22264

Merged
merged 1 commit into from
Nov 30, 2022
Merged

Conversation

BTatlock
Copy link
Contributor

@BTatlock BTatlock commented Nov 29, 2022

SUMMARY

No sources are added when importing zip files on Windows, as file paths are parsed using pathlib.PureWindowsPath. Schemas are defined using prefixes with trailing slashes, therefore file paths in zipfiles should instead be treated as pathlib.PurePosixPaths.

Although Superset does not have official Windows support, this change fixes imports without changing the behaviour on Unix, since instantiating pathlib.Path creates a pathlib.PurePosixPath.

TESTING INSTRUCTIONS

Import zipfile (e.g. superset import_dashboards -p dashboard_export.zip) on WIndows

No sources are added when importing zip files on Windows, as file paths are parsed using `pathlib.PureWindowsPath`. Schemas are defined using prefixes with trailing slashes, therefore file paths in zipfiles should instead be treated as `pathlib.PurePosixPath`s.

Although Superset does not have official Windows support, this change fixes imports without changing the behaviour on Unix, since instantiating `pathlib.Path` creates a `pathlib.PurePosixPath`.
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️
We hope to see you in our Slack community too!

@rusackas
Copy link
Member

Thank you for the contribution! You're right, that while we don't support Windows, it never hurts to improve the experience for those who wish to go down that road. I'm pinging @betodealmeida and @eschutho for review since they're close to the feature, but also pinging @jinghua-qa in case there are any concerns with supporting this from a QA standpoint.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

This is great, thanks! And #til!

@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Merging #22264 (9716a84) into master (fb3e717) will increase coverage by 1.29%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #22264      +/-   ##
==========================================
+ Coverage   65.54%   66.84%   +1.29%     
==========================================
  Files        1841     1841              
  Lines       70220    70220              
  Branches     7670     7670              
==========================================
+ Hits        46027    46936     +909     
+ Misses      22211    21302     -909     
  Partials     1982     1982              
Flag Coverage Δ
hive 52.56% <33.33%> (ø)
mysql 78.07% <100.00%> (ø)
postgres 78.14% <100.00%> (ø)
presto 52.45% <33.33%> (ø)
python 81.33% <100.00%> (+2.71%) ⬆️
sqlite 76.59% <100.00%> (ø)
unit 50.87% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/commands/importers/v1/utils.py 93.50% <100.00%> (ø)
superset/databases/api.py 93.53% <0.00%> (+0.30%) ⬆️
superset/sql_lab.py 82.12% <0.00%> (+0.38%) ⬆️
superset/views/base_api.py 98.44% <0.00%> (+0.38%) ⬆️
superset/db_engine_specs/presto.py 88.22% <0.00%> (+0.41%) ⬆️
superset/db_engine_specs/__init__.py 85.71% <0.00%> (+1.19%) ⬆️
superset/datasets/schemas.py 97.40% <0.00%> (+1.29%) ⬆️
superset/commands/exceptions.py 93.84% <0.00%> (+1.53%) ⬆️
superset/initialization/__init__.py 90.96% <0.00%> (+2.00%) ⬆️
superset/utils/log.py 93.91% <0.00%> (+2.02%) ⬆️
... and 53 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rusackas rusackas merged commit 32ccb97 into apache:master Nov 30, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants