-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
feat: handle new export in CLI #11803
Conversation
9f35df8
to
49b0598
Compare
Codecov Report
@@ Coverage Diff @@
## master #11803 +/- ##
===========================================
- Coverage 66.22% 53.11% -13.11%
===========================================
Files 937 438 -499
Lines 45325 15714 -29611
Branches 4341 4060 -281
===========================================
- Hits 30016 8347 -21669
+ Misses 15177 7367 -7810
+ Partials 132 0 -132
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
||
g.user = security_manager.find_user(username="admin") | ||
|
||
dashboard_ids = [id_ for (id_,) in db.session.query(Dashboard.id).all()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the ()
if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think without the ()
it's easy to overlook what's happening:
dashboard_ids = [id_ for id_, in db.session.query(Dashboard.id).all()]
Adding parentheses make the intent more clear, IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[dashboard.id for dashboard in db.session.query(Dashboard.id).all()]
is clearer, but no strong opinions about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpgaspar do you mean?
[dashboard.id for dashboard in db.session.query(Dashboard).all()]
That's a more expensive query (SELECT * FROM dbs
instead of SELECT id FROM dbs
), no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but no, I mean the way I wrote it that would generate a SELECT id from dbs
but it's just a detail, if you feel more comfortable unpacking the tuples the way you wrote got ahead.
dashboard_ids = [id_ for (id_,) in db.session.query(Dashboard.id).all()] | ||
timestamp = datetime.now().strftime("%Y%m%dT%H%M%S") | ||
root = f"dashboard_export_{timestamp}" | ||
dashboard_file = dashboard_file or f"{root}.zip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default (fallback) be expressed as a click option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played with click trying to have options depend on the feature flag, but couldn't get it to work since it depends on the app context. Let me give it another try.
49b2c3a
to
f93056e
Compare
7a9a056
to
ca172f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple of non blocking comments
feature_flags_func = config.GET_FEATURE_FLAGS_FUNC | ||
if feature_flags_func: | ||
# pylint: disable=not-callable | ||
feature_flags = feature_flags_func(feature_flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the CLI when feature_flags_func
uses g.user
or any other app context based variables, which seems to be the original intention of GET_FEATURE_FLAGS_FUNC
.
RuntimeError: Working outside of application context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a quick workaround in #12088.
This reverts commit 862c251.
SUMMARY
This PR adds the new export functionality to the
superset
CLI, when theVERSIONED_EXPORT
feature flag is enabled.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Tested with:
Verified that files were correct.
ADDITIONAL INFORMATION