-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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: save dataset and repopulate state #20965
fix: save dataset and repopulate state #20965
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20965 +/- ##
===========================================
- Coverage 66.38% 54.86% -11.53%
===========================================
Files 1767 1767
Lines 67232 67284 +52
Branches 7138 7140 +2
===========================================
- Hits 44633 36916 -7717
- Misses 20773 28541 +7768
- Partials 1826 1827 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
532561f
to
ef1b78e
Compare
metrics?: string[]; | ||
columns?: string[]; | ||
}; | ||
} |
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 is a first attempt at creating a set of types of that map to the api. cc @hughhhh cc @eric-briscoe. We talked about auto-generating this with Marshmallow, but this seemed like a decent start. Thoughts?
081228c
to
18e3c12
Compare
/testenv up |
@yousoph Ephemeral environment spinning up at http://35.167.113.206:8080. Credentials are |
@yousoph thanks for catching that. I just pushed up a fix for the dashboard button too. |
574fe39
to
f38811d
Compare
/testenv up |
superset/models/helpers.py
Outdated
inner_to_dttm or to_dttm, | ||
) | ||
] | ||
if isinstance(dttm_col, dict): |
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.
Use this pattern instead for grabbing the time_filter:
https://github.com/preset-io/superset/blob/master/superset/models/helpers.py#L1550
superset/models/helpers.py
Outdated
@@ -1331,7 +1334,8 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma | |||
|
|||
columns_by_name: Dict[str, "TableColumn"] = { | |||
col.get("column_name"): col | |||
for col in self.columns # col.column_name: col for col in self.columns | |||
# col.column_name: col for col in self.columns | |||
for col in self.columns |
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.
shouldn't this be for col in self.columns:
it's missing the colon
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.
It looks like it's the end of a dictionary comprehension, not a for loop, so no colon needed. The comment change btw was just part of my automated linting on line length. I'm not actually sure what the comment means, too. :)
|
||
return json_success( | ||
json.dumps( | ||
{"table_id": table.id, "data": sanitize_datasource_data(table.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.
👌🏾
/testenv up |
@yousoph Ephemeral environment spinning up at http://54.244.60.192:8080. Credentials are |
@yousoph Ephemeral environment spinning up at http://35.88.30.184:8080. Credentials are |
f38811d
to
9a43dd2
Compare
@@ -119,7 +120,7 @@ export const hydrateExplore = | |||
controls: initialControls, | |||
form_data: initialFormData, | |||
slice: initialSlice, | |||
controlsTransferred: [], | |||
controlsTransferred: explore.controlsTransferred, |
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.
@michael-s-molina do you see any problems with us pulling in state here on hydrate? It's not a property that exists in the persisted db.
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. The hydrateExplore
is the action responsible for mounting the Explore state so it shouldn't have a reference to itself. It will only work because there's a known problem where the save action is firing hydrateExplore
again but it shouldn't. We're calling hydrateExplore
on save intentionally because during the SPA work we wanted to avoid reloading the page but many of the existing logic depended on that. It would require a major refactor to change this behavior. Currently, explore.controlsTransferred
is being updated by UPDATE_FORM_DATA_BY_DATASOURCE
action. You'll probably won't need all the logic inside that action, so I suggest creating a new action to update this piece of state and call this new action from your code.
Ping me or @kgabryje if you need more assistance on this.
fetchMock.post(saveDatasetEndpoint, saveDatasetResponse); | ||
const dispatch = sinon.spy(); | ||
const getState = sinon.spy(() => ({ explore: { datasource } })); | ||
const dataset = await saveDataset(SAVE_DATASET_POST_ARGS)(dispatch); |
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.
nice way to test this!
looks good to me baring any of Michael's feedback! I'l approve! |
/testenv up |
@eschutho Ephemeral environment spinning up at http://34.219.161.252:8080. Credentials are |
LGTM |
Ephemeral environment shutdown and build artifacts deleted. |
* save dataset and repopulate state * disable dashboard button if dataset is missing * fix error message * fix tests (cherry picked from commit 463406f)
SUMMARY
This PR fixes a bug in the sqllab to explore chart with a query flow where upon saving, there was an error saying that the form fields had not been transferred when they had.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
Repro steps
1, query in sql and click create chart
2, create chart in explore and save chart
3, in save chart modal when chart power=query, remove dataset name and leave it blank
4, click save button
ADDITIONAL INFORMATION