Skip to content

EXPORT_CSV decimal separator format doesn't work for Decimal MySQL column #18218

@mbcsa

Description

@mbcsa

Description

"Export to CSV" does not respect EXPORT_CSV decimal separator option for a MySQL Decimal(x,y) column. I see that column is mapped as NEWDECIMAL.

To make it work I have to CAST to FLOAT on SQL query. Then it's mapped as FLOAT and respects decimal separator as configured.

How to reproduce the bug

  1. Configure superset_config.py with
CSV_EXPORT = {
    'encoding': 'utf-8',
    'sep': ';',
    'decimal': ','
}
  1. Create a query with a Decimal(x,y) field, Save and click Explore
  2. In Dataset options, click "Edit Dataset"
    image
  3. Verify that decimal column is shown as "NEWDECIMAL"
    image
  4. Configure "$,.2f" as format for column
    image
  5. Save Chart and add to a new Dashboard
  6. Go to Dashboard and Export CSV
  7. Verify that decimal separator is not being formatted as configured in step 1
    image

Expected results

Export CSV Option USES configured decimal separator when Datasource Column has as Decimal data type in a MySQL Datasource

Actual results

Export CSV Option DOES NOT use configured decimal separator when a Datasource Column has as Decimal data type in a MySQL Datasource

Environment

  • browser type and version: User-Agent | Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0
  • superset version: Superset 0.0.0dev (SHA: 80f5154)
  • python version: Python 3.9.5
  • node.js version: v14.18.3
  • any feature flags active:
FEATURE_FLAGS = {
    "ALERT_REPORTS": True,
    "ENABLE_TEMPLATE_PROCESSING": True
}
  • Datasource MySQL version: mariadb-10.5.9

Checklist

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Metadata

Metadata

Assignees

Labels

#bugBug reportvalidation:validatedA committer has validated / submitted the issue or it was reported by multiple users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions