john-bodley opened a new pull request #8935: [fix] Enforce the query result data to be pandas.DataFrame URL: https://github.com/apache/incubator-superset/pull/8935 ### CATEGORY Choose one - [x] Bug Fix - [ ] Enhancement (new features, refinement) - [ ] Refactor - [ ] Add tests - [ ] Build / Development Environment - [ ] Documentation ### SUMMARY Previously `df` attribute of the [`QueryResult`](https://github.com/apache/incubator-superset/blob/5b690f94116b5b77c0af566d24f298cc6db469b9/superset/models/helpers.py#L364) class could either be `None` or a `pandas.DataFrame` object. This was problematic as the `None` type wasn't always handled, e.g. [here](https://github.com/apache/incubator-superset/blob/5b690f94116b5b77c0af566d24f298cc6db469b9/superset/connectors/sqla/models.py#L932) and [here](https://github.com/apache/incubator-superset/blob/5b690f94116b5b77c0af566d24f298cc6db469b9/superset/viz.py#L191) would both throw an exception. This PR ensures that the `df` attribute is always a `pandas.DataFrame` object which can be empty. Additionally it short circuits the processing of data for the `NVD3TimeSeriesViz` class if the data-frame is empty. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TEST PLAN CI. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Changes UI - [ ] Requires DB Migration. - [ ] Confirm DB Migration upgrade and downgrade tested. - [ ] Introduces new feature or API - [ ] Removes existing feature or API ### REVIEWERS
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
