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] Ensuring cache warmup respects request form data #9665
[fix] Ensuring cache warmup respects request form data #9665
Conversation
aaa05e2
to
fdb2aa6
Compare
fdb2aa6
to
3069e82
Compare
@john-bodley I agree that it's not optimal to be passing around |
@villebro I wonder if it should be added to |
@john-bodley I didn't remember that method; You're right, it should probably go in there. I'm assuming Mental note: that method is really bloated/complex and doesn't have any unit tests, should probably be broken up at some point. |
3069e82
to
fc66d57
Compare
@villebro I've updated the PR to use the somewhat scary I've added some basic unit tests to |
fc66d57
to
e07af9a
Compare
@@ -101,15 +101,18 @@ def get_viz( | |||
|
|||
def get_form_data(slice_id=None, use_slice_data=False): | |||
form_data = {} | |||
post_data = request.form.get("form_data") |
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.
@villebro I was spinning my wheels for quite some time trying to get test_request_context()
to work and then realize that this isn't explicitly related to the POST method and not is the body of the request a JSON object, i.e., the form_data
field is actually further encoded as a JSON object.
The form-data is messy and we probably should strive to standardize this at some stage. For now I've renamed post_data
as request_form_data
which is more accurate.
e07af9a
to
2005ea1
Compare
Codecov Report
@@ Coverage Diff @@
## master #9665 +/- ##
==========================================
+ Coverage 65.70% 70.60% +4.89%
==========================================
Files 581 581
Lines 30219 30318 +99
Branches 3071 3096 +25
==========================================
+ Hits 19856 21406 +1550
+ Misses 10182 8801 -1381
+ Partials 181 111 -70
Continue to review full report at Codecov.
|
2005ea1
to
4181017
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.
superset/views/utils.py
Outdated
@@ -101,15 +101,18 @@ def get_viz( | |||
|
|||
def get_form_data(slice_id=None, use_slice_data=False): |
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.
While we're at it, let's put in type annotations here; I was surprised to see that this was returning a tuple.
4181017
to
38f9c12
Compare
url_id = request.args.get("r") | ||
if url_id: | ||
saved_url = db.session.query(models.Url).filter_by(id=url_id).first() | ||
if saved_url: | ||
url_str = parse.unquote_plus( | ||
saved_url.url.split("?")[1][10:], encoding="utf-8", errors=None | ||
saved_url.url.split("?")[1][10:], encoding="utf-8" |
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.
Co-authored-by: John Bodley <john.bodley@airbnb.com> (cherry picked from commit 7f89f12)
CATEGORY
Choose one
SUMMARY
Fixes #9664.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS
to: @dpgaspar @etr2460 @villebro