
Serialization IonToCsv
CertifiedConvert an ION file to the CSV format
Serialization IonToCsv
Convert an ION file to the CSV format
Supports configurable field separator, text delimiter, and line delimiter. Use quoteMode to control field quoting; alwaysDelimitText is deprecated in favor of quoteMode.
type: io.kestra.plugin.serdes.csv.IonToCsvExamples
Download a CSV file, transform it in SQL and store the transformed data as a CSV file.
id: ion_to_csv
namespace: company.team
tasks:
- id: download_csv
type: io.kestra.plugin.core.http.Download
description: salaries of data professionals from 2020 to 2023 (source ai-jobs.net)
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/salaries.csv
- id: avg_salary_by_job_title
type: io.kestra.plugin.jdbc.duckdb.Query
inputFiles:
data.csv: "{{ outputs.download_csv.uri }}"
sql: |
SELECT
job_title,
ROUND(AVG(salary),2) AS avg_salary
FROM read_csv_auto('{{ workingDir }}/data.csv', header=True)
GROUP BY job_title
HAVING COUNT(job_title) > 10
ORDER BY avg_salary DESC;
store: true
- id: result
type: io.kestra.plugin.serdes.csv.IonToCsv
from: "{{ outputs.avg_salary_by_job_title.uri }}"
Query a database and export to CSV with quoted strings but unquoted numbers using the NON_NUMERIC quote mode.
id: export_csv_non_numeric
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.snowflake.Query
fetchType: STORE
sql: |
SELECT
Referencia,
Descripcion,
Cantidad,
Precio
FROM my_table
url: "jdbc:snowflake://{{ namespace.snowflake.account }}.snowflakecomputing.com"
username: "{{ namespace.snowflake.user }}"
password: "{{ secret('SNOWFLAKE_PASSWORD') }}"
- id: to_csv
type: io.kestra.plugin.serdes.csv.IonToCsv
from: "{{ outputs.query.uri }}"
header: false
quoteMode: NON_NUMERIC
Properties
from *Requiredstring
Source file URI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}.
alwaysDelimitText booleanstring
falseWhether fields should always be delimited using the textDelimiter option
Deprecated: use quoteMode instead for more control. If quoteMode is set, this property is ignored.
charset string
UTF-8The name of a supported charset
dateFormat string
yyyy-MM-ddFormat to use for date
dateTimeFormat string
yyyy-MM-dd'T'HH:mm:ss.SSS[XXX]Format to use for zoned datetime
fieldSeparator string
,The field separator character
header booleanstring
trueSpecifies if the first line should be the header
lineDelimiter string
The character used to separate rows
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
quoteMode string
ALWAYSREQUIREDNON_NUMERICControls when fields are quoted
When set, this property takes precedence over alwaysDelimitText.
ALWAYS: quote all fields.REQUIRED: only quote fields that contain special characters (field separator, quote character, or newlines) as per RFC 4180.NON_NUMERIC: quote all fields except those that are numeric (integer or decimal). Useful when downstream systems expect quoted strings but unquoted numbers.
textDelimiter string
"The text delimiter character
timeFormat string
HH:mm:ss[XXX]Format to use for time
timeZoneId string
Etc/UTCTimezone to use when no timezone can be parsed on the source
Outputs
size integer
0The number of records converted
uri string
uriURI of a temporary result file
Metrics
records counter
Number of records converted