dosubot[bot] commented on issue #36682:
URL: https://github.com/apache/superset/issues/36682#issuecomment-3662355695

   <!-- Greeting -->
   Hi @pipina! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the 
superset team.
   
   <!-- Answer -->
   The root cause is that the email report workflow re-parses CSV data using 
pandas with the default comma delimiter, ignoring your custom CSV_EXPORT 
settings. This causes a parsing error when your CSV uses a non-default 
delimiter like `;`, resulting in HTTP 500 errors for email reports, while GUI 
exports work fine.
   
   To fix this, update the `apply_client_processing` function in 
`superset/charts/client_processing.py` so it respects your delimiter and 
decimal settings. Here’s how you can do it:
   
   1. Import `current_app` from Flask at the top of the file:
      ```python
      from flask import current_app
      ```
   
   2. In the CSV parsing block, retrieve the delimiter and decimal from config 
and pass them to `pd.read_csv`:
      ```python
      csv_export_config = current_app.config.get("CSV_EXPORT", {})
      sep = csv_export_config.get("sep", ",")
      decimal = csv_export_config.get("decimal", ".")
      df = pd.read_csv(StringIO(data), sep=sep, decimal=decimal)
      ```
   
   This change ensures that CSV parsing in email reports matches your GUI 
export settings and prevents the parsing error. The rest of the workflow 
(including encoding) already pulls from `CSV_EXPORT` where needed.
   
   There’s no official documentation or open issue tracking this bug, but the 
code pattern above matches how Superset handles CSV_EXPORT elsewhere in the 
codebase. GUI exports are unaffected; only email/report CSV exports with 
non-default delimiters are broken until this is fixed. 
   
   Reference: 
[superset/charts/client_processing.py](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/client_processing.py#L311-L387)
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/235f157d-6ad0-4f7b-8281-622e1ce2d8a2?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20root%20cause%20is%20that%20the%20email%20report%20workflow%20re-parses%20CSV%20data%20using%20pandas%20with%20the%20default%20comma%20delimiter%2C%20ignoring%20your%20custom%20CSV_EXPORT%20settings.%20This%20causes%20a%20parsing%20error%20when%20your%20CSV%20uses%20a%20non-default%20delimiter%20like%20%60%3B%60%2C%20resulting%20in%20HTTP%20500%20errors%20for%20email%20reports%2C%20while%20GUI%20exports%20work%20fine.%0A%0ATo%20fix%20this%2C%20update%20the%20%60apply_client_processing%60%20function%20in%20%60superset/charts/client_processing.py%60%20so%20it%20respects%20your%20delimiter%20and%20decimal%20settings.%20Here%E2%80%99s%20how%20you%20can%20do%20it%3A%0A%0A1.%20Import%20%60current_app%60%20from%20Flask%20at%20the%20top%20of%20the%20f
 
ile%3A%0A%20%20%20%60%60%60python%0A%20%20%20from%20flask%20import%20current_app%0A%20%20%20%60%60%60%0A%0A2.%20In%20the%20CSV%20parsing%20block%2C%20retrieve%20the%20delimiter%20and%20decimal%20from%20config%20and%20pass%20them%20to%20%60pd.read_csv%60%3A%0A%20%20%20%60%60%60python%0A%20%20%20csv_export_config%20%3D%20current_app.config.get%28%22CSV_EXPORT%22%2C%20%7B%7D%29%0A%20%20%20sep%20%3D%20csv_export_config.get%28%22sep%22%2C%20%22%2C%22%29%0A%20%20%20decimal%20%3D%20csv_export_config.get%28%22decimal%22%2C%20%22.%22%29%0A%20%20%20df%20%3D%20pd.read_csv%28StringIO%28data%29%2C%20sep%3Dsep%2C%20decimal%3Ddecimal%29%0A%20%20%20%60%60%60%0A%0AThis%20change%20ensures%20that%20CSV%20parsing%20in%20email%20reports%20matches%20your%20GUI%20export%20settings%20and%20prevents%20the%20parsing%20error.%20The%20rest%20of%20the%20workflow%20%28including%20encoding%29%20already%20pulls%20from%20%60CSV_EXPORT%60%20where%20needed.%0A%0AThere%E2%80%99s%20no%20official%20documentation%20or%20
 
open%20issue%20tracking%20this%20bug%2C%20but%20the%20code%20pattern%20above%20matches%20how%20Superset%20handles%20CSV_EXPORT%20elsewhere%20in%20the%20codebase.%20GUI%20exports%20are%20unaffected%3B%20only%20email/report%20CSV%20exports%20with%20non-default%20delimiters%20are%20broken%20until%20this%20is%20fixed.%20%0A%0AReference%3A%20%5Bsuperset/charts/client_processing.py%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/client_processing.py%23L311-L387%29)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36682)


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