Read AWS Ion data and write Ion text or binary with typed mappings
Installing and Loading
INSTALL ion FROM community;
LOAD ion;
Example
-- Read Ion files (text or binary)
SELECT * FROM read_ion('sample.ion');
-- Control schema and parsing options
SELECT * FROM read_ion('sample.ion', columns := {id: 'BIGINT', label: 'VARCHAR'});
SELECT * FROM read_ion('scalars.ion', records := false);
SELECT * FROM read_ion('array.ion', format := 'array');
-- Write Ion text or binary
CREATE TABLE ion_demo AS SELECT 1::INTEGER AS id, 'hello' AS label;
COPY ion_demo TO 'out.ion' (FORMAT ION);
COPY ion_demo TO 'out.ion' (FORMAT ION, BINARY TRUE);
About ion
The ion extension enables DuckDB to read AWS Ion in text and binary formats and write Ion text or binary, preserving Ion types where possible for richer analytics.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| read_ion | table | NULL | NULL | |
| to_ion | scalar | NULL | NULL |