Avro IonToAvro
Certified
Convert an ION file to the Avro format
Avro IonToAvro
Convert an ION file to the Avro format
Converts an Amazon ION file to Avro format using a JSON Avro schema. If no schema is provided, one is inferred by scanning up to numberOfRowsToScan rows. Use onBadLines to control whether records that fail validation cause an error, log a warning, or are silently skipped.
type: io.kestra.plugin.serdes.avro.IonToAvroExamples
Convert a CSV dataset to the Avro format via ION.
id: divvy_tripdata
namespace: company.team
variables:
file_id: "{{ execution.startDate | dateAdd(-3, 'MONTHS') | date('yyyyMM') }}"
tasks:
- id: get_zipfile
type: io.kestra.plugin.core.http.Download
uri: "https://divvy-tripdata.s3.amazonaws.com/{{ render(vars.file_id) }}-divvy-tripdata.zip"
- id: unzip
type: io.kestra.plugin.compress.ArchiveDecompress
algorithm: ZIP
from: "{{ outputs.get_zipfile.uri }}"
- id: convert
type: io.kestra.plugin.serdes.csv.CsvToIon
from: "{{ outputs.unzip.files[render(vars.file_id) ~ '-divvy-tripdata.csv'] }}"
- id: to_avro
type: io.kestra.plugin.serdes.avro.IonToAvro
from: "{{ outputs.convert.uri }}"
datetimeFormat: "yyyy-MM-dd' 'HH:mm:ss"
schema: |
{
"type": "record",
"name": "Ride",
"namespace": "com.example.bikeshare",
"fields": [
{"name": "ride_id", "type": "string"},
{"name": "rideable_type", "type": "string"},
{"name": "started_at", "type": {"type": "long", "logicalType": "timestamp-millis"}},
{"name": "ended_at", "type": {"type": "long", "logicalType": "timestamp-millis"}},
{"name": "start_station_name", "type": "string"},
{"name": "start_station_id", "type": "string"},
{"name": "end_station_name", "type": "string"},
{"name": "end_station_id", "type": "string"},
{"name": "start_lat", "type": "double"},
{"name": "start_lng", "type": "double"},
{
"name": "end_lat",
"type": ["null", "double"],
"default": null
},
{
"name": "end_lng",
"type": ["null", "double"],
"default": null
},
{"name": "member_casual", "type": "string"}
]
}Installation
Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:
kestractl plugins get io.kestra.plugin:plugin-serdes --compatible-for $KESTRA_VERSION For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.
Properties
from *string
Source file URI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
A dataset stored outside of a database table.
Declares a dataset that a task writes outside of a database table, such as files in a data lake. system, location and format are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the dataset a task has written.
id: export_trips
namespace: company.data
tasks:
- id: export
type: io.kestra.plugin.core.log.Log
message: Exporting trips
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Dataset
id: trips
system: s3
location: s3://company-lake/trips/
format: parquet1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
The format of the data, for example parquet or csv.
Where the dataset is stored, for example a bucket prefix.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The system storing the dataset, for example s3 or gcs.
A deployment, grouping the resources provisioned together.
Declares a deployment that groups the resources a flow provisions together. Other assets join a deployment by naming it in their partOf. A TtlTrigger targets deployments when no assetType is set.
Register a deployment and the virtual machine it is made of.
id: provision_environment
namespace: company.infra
tasks:
- id: provision
type: io.kestra.plugin.core.log.Log
message: Provisioning staging-eu
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Deployment
id: staging-eu
displayName: Staging EU
- type: io.kestra.plugin.ee.assets.VM
id: staging-eu-web-01
provider: aws
region: eu-west-1
partOf:
id: staging-eu1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
A file in a storage system.
Declares a single file that a task writes to a storage system. system and path are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the file a task has uploaded.
id: upload_report
namespace: company.finance
tasks:
- id: upload
type: io.kestra.plugin.core.log.Log
message: Uploading the monthly report
assets:
outputs:
- type: io.kestra.plugin.ee.assets.File
id: monthly-report
system: s3
path: s3://company-reports/monthly.pdf1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The path or URI of the file.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The storage system holding the file, for example s3 or sftp.
A database table.
Declares a database table that a task creates or loads. system, database, schema and name are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the table a task has created.
id: create_orders_table
namespace: company.data
tasks:
- id: create
type: io.kestra.plugin.core.log.Log
message: Creating analytics.public.orders
assets:
outputs:
- type: io.kestra.plugin.ee.assets.Table
id: analytics.public.orders
system: postgres
database: analytics
schema: public
name: orders1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
The database the table belongs to.
{}The name of the table.
1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The schema the table belongs to.
The database system, for example postgres, snowflake or bigquery.
A virtual machine.
Declares a virtual machine that a task provisions or manages. provider, region and state are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.
Register the virtual machine a task has provisioned.
id: provision_vm
namespace: company.infra
tasks:
- id: provision
type: io.kestra.plugin.core.log.Log
message: Provisioning web-01
assets:
outputs:
- type: io.kestra.plugin.ee.assets.VM
id: web-01
displayName: Web server 01
provider: aws
region: eu-west-1
state: running1150100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The cloud provider or hypervisor hosting the virtual machine, for example aws, gcp or vsphere.
The region or zone the virtual machine runs in.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The state of the virtual machine, for example running or stopped.
io.kestra.core.models.assets.Custom
11501Custom asset type
100The day-2 actions offered on this asset, each backing onto a flow.
Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
1The namespace of the flow backing this action.
The label displayed on this action.
20The conditions under which this action is offered.
All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
dateFormat string
yyyy-MM-dd[XXX]Format to use when parsing date
datetimeFormat string
yyyy-MM-dd'T'HH:mm[:ss][.SSSSSS][XXX]Format to use when parsing datetime
Default value is yyyy-MM-dd'T'HH: mm[: ss][.SSSSSS][XXX]
decimalSeparator string
.Character to recognize as decimal point (e.g. use ‘,’ for European data)
Default value is '.'
falseValues array
["f","false","disabled","0","off","no",""]Values to consider as False
inferAllFields booleanstring
falseTry to infer all fields
If true, schema inference scans all rows (ignoring numberOfRowsToScan) and attempts to infer all field types using trueValues, falseValues, and nullValues. This prevents fields that are null in the first scanned rows from being typed as NULL. If false, only the first numberOfRowsToScan rows are scanned. trueValues and falseValues only apply to fields whose schema has a boolean branch; string columns keep their values verbatim.
nullValues array
["","#N/A","#N/A N/A","#NA","-1.#IND","-1.#QNAN","-NaN","1.#IND","1.#QNAN","NA","n/a","nan","null"]Values to consider as null
Applies when converting to a NULL type or to a UNION containing a NULL branch, independent of inferAllFields. A string listed here resolves to null regardless of union branch order (e.g. both ["null","string"] and ["string","null"]). Narrow this list if you need the literal strings.
numberOfRowsToScan integerstring
100Number of rows that will be scanned while inferring. The more rows scanned, the more precise the output schema will be
Only use when the 'schema' property is empty. Ignored for schema inference when inferAllFields is true — in that case, all rows are scanned.
onBadLines string
ERRORERRORWARNSKIPHow to handle bad records (e.g., null values in non-nullable fields or type mismatches)
Can be ERROR, WARN, or SKIP.
schema string
The avro schema associated with the data
If empty, the task will try to infer the schema from the current data; use the 'numberOfRowsToScan' property if needed
strictSchema booleanstring
falseWhether to consider a field present in the data but not declared in the schema as an error
Default value is false
timeFormat string
HH:mm[:ss][.SSSSSS][XXX]Format to use when parsing time
timeZoneId string
Etc/UTCTimezone to use when no timezone can be parsed on the source
If null, the timezone defaults to UTC. Default value is the system timezone
trueValues array
["t","true","enabled","1","on","yes"]Values to consider as True
Outputs
size integer
0The number of records written
Rows skipped under onBadLines: WARN or SKIP are not counted.
uri string
uriURI of a temporary result file
Metrics
records counter
Number of records written
skippedRecords counter
Number of records skipped under onBadLines: SKIP