nitishagar opened a new pull request, #38616:
URL: https://github.com/apache/superset/pull/38616

   ### SUMMARY
   
   When `CSV_EXPORT` config uses a non-default delimiter (e.g. `sep=";"`) and 
decimal separator (e.g. `decimal=","`), GUI CSV exports work correctly because 
they go through `query_context_processor.py` which passes 
`**current_app.config["CSV_EXPORT"]` to `df_to_escaped_csv()`. However, CSV 
email reports take a different path through `apply_client_processing()` in 
`client_processing.py`, which called `pd.read_csv(StringIO(data))` without 
reading `sep`/`decimal` from the config.
   
   This caused pandas to misparse the semicolon-delimited CSV (treating the 
whole row as one column), which then broke the pivot/table post-processor and 
returned an HTTP 500.
   
   **Fix:** Read `sep` and `decimal` from `current_app.config["CSV_EXPORT"]` 
and pass them to `pd.read_csv()`, defaulting to `","` and `"."` respectively 
when not configured.
   
   Fixes #36682
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend-only fix.
   
   ### TESTING INSTRUCTIONS
   
   1. Configure `CSV_EXPORT = {"sep": ";", "decimal": ","}` in 
`superset_config.py`
   2. Create a chart and schedule a CSV email report
   3. **Before fix:** report fails with HTTP 500 (pandas misparsed the 
semicolon-delimited data)
   4. **After fix:** report processes correctly and sends valid CSV email
   
   Unit test added:
   ```bash
   pytest 
tests/unit_tests/charts/test_client_processing.py::test_apply_client_processing_csv_format_custom_delimiter
 -v
   ```
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #36682
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] 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