Avro IonToAvro

Avro IonToAvro

Certified

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.

yaml
type: io.kestra.plugin.serdes.avro.IonToAvro

Convert a CSV dataset to the Avro format via ION.

yaml
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

Source file URI

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.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

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

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

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.

Example

Register the dataset a task has written.

yaml
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: parquet
id*string
Min length1
Max length150
assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

descriptionstring
displayNamestring
formatstring

The format of the data, for example parquet or csv.

locationstring

Where the dataset is stored, for example a bucket prefix.

metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

systemstring

The system storing the dataset, for example s3 or gcs.

typeobject

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.

Example

Register a deployment and the virtual machine it is made of.

yaml
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-eu
id*string
Min length1
Max length150
assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

typeobject

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.

Example

Register the file a task has uploaded.

yaml
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.pdf
id*string
Min length1
Max length150
assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

pathstring

The path or URI of the file.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

systemstring

The storage system holding the file, for example s3 or sftp.

typeobject

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.

Example

Register the table a task has created.

yaml
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: orders
id*string
Min length1
Max length150
assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

databasestring

The database the table belongs to.

descriptionstring
displayNamestring
metadataobject
Default{}
namestring

The name of the table.

namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

schemastring

The schema the table belongs to.

systemstring

The database system, for example postgres, snowflake or bigquery.

typeobject

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.

Example

Register the virtual machine a task has provisioned.

yaml
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: running
id*string
Min length1
Max length150
assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

providerstring

The cloud provider or hypervisor hosting the virtual machine, for example aws, gcp or vsphere.

regionstring

The region or zone the virtual machine runs in.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

statestring

The state of the virtual machine, for example running or stopped.

typeobject
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

assetActionsarray
Max items100

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

flowId*string
Min length1

The id of the flow backing this action.

namespace*string
Min length1

The namespace of the flow backing this action.

labelstring

The label displayed on this action.

whenarray
Max items20

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

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

id*string
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

Defaultyyyy-MM-dd[XXX]

Format to use when parsing date

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

Default.

Character to recognize as decimal point (e.g. use ‘,’ for European data)

Default value is '.'

SubTypestring
Default["f","false","disabled","0","off","no",""]

Values to consider as False

Defaultfalse

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

SubTypestring
Default["","#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.

Default100

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

DefaultERROR
Possible Values
ERRORWARNSKIP

How to handle bad records (e.g., null values in non-nullable fields or type mismatches)

Can be ERROR, WARN, or SKIP.

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

Defaultfalse

Whether to consider a field present in the data but not declared in the schema as an error

Default value is false

DefaultHH:mm[:ss][.SSSSSS][XXX]

Format to use when parsing time

DefaultEtc/UTC

Timezone to use when no timezone can be parsed on the source

If null, the timezone defaults to UTC. Default value is the system timezone

SubTypestring
Default["t","true","enabled","1","on","yes"]

Values to consider as True

Default0

The number of records written

Rows skipped under onBadLines: WARN or SKIP are not counted.

Formaturi

URI of a temporary result file

Number of records written

Number of records skipped under onBadLines: SKIP