-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: call screenshot to store query_context
#15846
feat: call screenshot to store query_context
#15846
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15846 +/- ##
==========================================
- Coverage 77.05% 76.76% -0.30%
==========================================
Files 986 986
Lines 51944 51993 +49
Branches 7081 7090 +9
==========================================
- Hits 40025 39911 -114
- Misses 11693 11856 +163
Partials 226 226
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
869cfa4
to
c089468
Compare
superset/reports/commands/execute.py
Outdated
# get a screenshot to force the chart to produce and save the query | ||
# context. | ||
if self._report_schedule.chart.query_context is None: | ||
self._get_screenshot() |
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.
do you think there may be a case where the screenshot finishes before the put? Do we need some error handling for that case?
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.
Good point, I'll add some error handling.
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 left one small comment/question.
* feat: call screenshot to store query_context * Add unit test * Move updateQueryContext to ExploreChartPanel * Add error handling * Fix code * Fix logic
* feat: call screenshot to store query_context * Add unit test * Move updateQueryContext to ExploreChartPanel * Add error handling * Fix code * Fix logic
* feat: call screenshot to store query_context * Add unit test * Move updateQueryContext to ExploreChartPanel * Add error handling * Fix code * Fix logic
* feat: call screenshot to store query_context * Add unit test * Move updateQueryContext to ExploreChartPanel * Add error handling * Fix code * Fix logic
SUMMARY
#15830 modified the
_get_csv_data
functionality in the reports executor to use a new chart API introduced in #15827. One problem is that the new API can only be called for charts that were saved with theirquery_context
, a change that was introduced in #15824.Pre-existing charts have
query_context
set to null, so we can't use the new API with them. As a workaround, @hughhhh implemented logic to savequery_context
when a chart that doesn't have it saved is loaded (#15865). This PR leverages that work by taking a screenshot of the chart using Selenium whenever we need to call the CSV API butquery_context
is null.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
query_context
of the chart (UPDATE slices SET query_context = NULL WHERE id=XXX
)query_context
should be back.ADDITIONAL INFORMATION