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

   ### SUMMARY
   
   This PR fixes GitHub issue #32371 where the `CSV_EXPORT` configuration was 
not being applied correctly in certain CSV export scenarios.
   
   **The issue had two parts:**
   1. Custom `decimal` separator (e.g., `decimal: ","`) was ignored in exports
   2. Pivoted CSV exports did not respect `CSV_EXPORT` settings
   
   **Root cause:**
   - In `superset/charts/client_processing.py`, the `apply_client_processing()` 
function calls `to_csv()` without passing the `CSV_EXPORT` config when 
exporting pivoted/processed data
   - In `superset/commands/streaming_export/base.py`, the streaming CSV export 
uses Python's `csv.writer` directly without applying the `sep` or `decimal` 
config values
   
   **Changes:**
   - `superset/charts/client_processing.py`: Pass `CSV_EXPORT` config to 
`to_csv()` when exporting processed (pivoted) CSV data
   - `superset/commands/streaming_export/base.py`: 
     - Use the `sep` parameter as the CSV delimiter for `csv.writer`
     - Add `_format_row_values()` method to format float values with the custom 
`decimal` separator
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:**
   With `CSV_EXPORT = {"encoding": "utf-8", "sep": ";", "decimal": ","}`:
   - Regular CSV export: Separator works (`;`), but decimal is ignored (still 
`.`)
   - Pivoted CSV export: Neither separator nor decimal config is applied
   
   **After:**
   - Both regular and pivoted CSV exports respect the full `CSV_EXPORT` 
configuration
   - Streaming exports also respect the configuration
   
   ### TESTING INSTRUCTIONS
   
   1. Add the following to your `superset_config.py`:
      ```python
      CSV_EXPORT = {"encoding": "utf-8", "sep": ";", "decimal": ","}
      ```
   2. Restart Superset
   3. Create a chart with numeric data (e.g., a table or pivot table)
   4. Export to CSV (both regular and pivoted if using pivot table)
   5. Verify that:
      - Columns are separated by semicolons (`;`)
      - Decimal values use commas (e.g., `1,5` instead of `1.5`)
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #32371
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ---
   
   Generated with [Claude Code](https://claude.ai/code)
   
   Co-Authored-By: Claude <[email protected]>


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