# Write a configuration file

Publish / file

A variant of [Write another file format](https://meridian.online/operations/write-another-file-format).

Write rows as key and value pairs or structured settings, such as a properties, INI, TOML or YAML file.

Page: <https://meridian.online/operations/write-another-file-format/write-a-configuration-file>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

write rows as properties, INI, TOML and YAML settings files

```sql
CREATE TEMP TABLE settings AS SELECT * FROM (VALUES
  (1, 'db', 'host', 'localhost'), (2, 'db', 'port', '5432'), (3, 'app', 'name', 'orders "v2"')) t(pos, section, key, value);
-- a number is written bare and any other value as a double-quoted string, which TOML and YAML both read
CREATE TEMP TABLE shown AS
SELECT *, CASE WHEN try_cast(value AS BIGINT) IS NOT NULL THEN value ELSE to_json(value)::VARCHAR END AS literal,
       min(pos) OVER (PARTITION BY section) AS section_pos
FROM settings;
COPY (SELECT section || '.' || key || '=' || value FROM shown ORDER BY pos) TO '<your_scratch_dir>/out.properties' (FORMAT csv, HEADER false, QUOTE '', ESCAPE '', DELIMITER '~');
COPY (SELECT line FROM (
        SELECT DISTINCT section_pos, 0 AS o, 0 AS pos, '[' || section || ']' AS line FROM shown
        UNION ALL SELECT section_pos, 1, pos, key || ' = ' || literal FROM shown) ORDER BY section_pos, o, pos)
  TO '<your_scratch_dir>/out.toml' (FORMAT csv, HEADER false, QUOTE '', ESCAPE '', DELIMITER '~');
COPY (SELECT line FROM (
        SELECT DISTINCT section_pos, 0 AS o, 0 AS pos, '[' || section || ']' AS line FROM shown
        UNION ALL SELECT section_pos, 1, pos, key || ' = ' || value FROM shown) ORDER BY section_pos, o, pos)
  TO '<your_scratch_dir>/out.ini' (FORMAT csv, HEADER false, QUOTE '', ESCAPE '', DELIMITER '~');
COPY (SELECT line FROM (
        SELECT DISTINCT section_pos, 0 AS o, 0 AS pos, section || ':' AS line FROM shown
        UNION ALL SELECT section_pos, 1, pos, '  ' || key || ': ' || literal FROM shown) ORDER BY section_pos, o, pos)
  TO '<your_scratch_dir>/out.yaml' (FORMAT csv, HEADER false, QUOTE '', ESCAPE '', DELIMITER '~');
SELECT CASE WHEN ((SELECT content FROM read_text('<your_scratch_dir>/out.properties')) = 'db.host=localhost' || chr(10) || 'db.port=5432' || chr(10) || 'app.name=orders "v2"' || chr(10) AND (SELECT content FROM read_text('<your_scratch_dir>/out.toml')) = '[db]' || chr(10) || 'host = "localhost"' || chr(10) || 'port = 5432' || chr(10) || '[app]' || chr(10) || 'name = "orders \"v2\""' || chr(10) AND (SELECT content FROM read_text('<your_scratch_dir>/out.ini')) = '[db]' || chr(10) || 'host = localhost' || chr(10) || 'port = 5432' || chr(10) || '[app]' || chr(10) || 'name = orders "v2"' || chr(10) AND (SELECT content FROM read_text('<your_scratch_dir>/out.yaml')) = 'db:' || chr(10) || '  host: "localhost"' || chr(10) || '  port: 5432' || chr(10) || 'app:' || chr(10) || '  name: "orders \"v2\""' || chr(10)) THEN 'as expected' ELSE error('the properties, TOML, INI and YAML files were not written with their sections, bare numbers and quoted, escaped strings') END AS verdict;
```

Replace `<your_scratch_dir>` with a directory of your own that you can write to before running the statement.

The statement writes `out.ini`, `out.properties`, `out.toml` and `out.yaml` itself, in `<your_scratch_dir>`.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- Duckle: [`TOML`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`YAML`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Apache Hop: [`Properties file Output`](https://hop.apache.org/manual/latest/pipeline/transforms/propertyoutput.html) (read 2026-09-27)
- Pentaho Data Integration: [`Properties Output`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Talend: [`tFileOutputProperties`](https://help.qlik.com/talend/en-US/components/8.0/properties/properties-component) (read 2026-09-27)
