john-bodley opened a new pull request, #24737:
URL: https://github.com/apache/superset/pull/24737

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   
   This PR addresses an issue raised by @padbk in 
https://github.com/apache/superset/discussions/24581#discussioncomment-6425918 
related to sending an alert/revert via a CSV. The actual error was rather 
cryptic, 
   
   ```
   Error: Failed generating csv HTTP Error 400: BAD REQUEST
   ```
   
   Specifically the RESTful `/api/v1/chart/{pk}/data/?format=csv` API endpoint 
was failing with the following error, 
   
   ```
   {
     "message": "Request is incorrect: {'queries': {0: {'extras': 
{'having_druid': ['Unknown field.']}}}}"
   }
   ```
   
   which turned out to be related to 
https://github.com/apache/superset/pull/23997, i.e., the referenced PR (which I 
authored) didn't remove the now obsolete parameters from the `slices` table. 
This PR remedies said issue.
   
   I used Airbnb's vast corpus (consisting of ~ 150k charts) to identify 
if/where the following form-data key were persisted to the database:
   
   - `druid_time_origin`
   - `having_druid`
   - `having_filters`
   - `granularity`
   
   I wasn't able to find `having_filters` anywhere, but it was somewhat 😢 to 
see that the `druid_time_origin` and `granularity` fields were actually present 
in three separate places:
   
   1. In the `slices.params` column
   2. In the `form_data` field of the `slices.query_context` column.
   3. In the queries` field of the `slices.query_context` column.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   
   CI and added/tested a DB migration and confirmed that the output was correct.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [x] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [x] Migration is atomic, supports rollback & is backwards-compatible
     - [x] Confirm DB migration upgrade and downgrade tested
     - [x] Runtime estimates and downtime expectations provided << 5 minutes at 
Airbnb with ~ 150k charts
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to