Publish / file · All operations
Write a configuration file
A variant of Write another file format
Write rows as key and value pairs or structured settings, such as a properties, INI, TOML or YAML file.
Status
- In arcform
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
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.tomlandout.yamlitself, in<your_scratch_dir>. - It needs nothing installed beyond DuckDB itself.
- The statement checks its own result and raises an error when it is wrong: “the properties, TOML, INI and YAML files were not written with their sections, bare numbers and quoted, escaped strings”.
- It passed on DuckDB
v2.0.0 (Cyanoptera) d54cbbe3df.
What other tools call it
Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).
Apache Hop (1)
Properties file Outputread 2026-09-27Write key and value pairs to a Java properties file
Duckle (2)
Pentaho Data Integration (1)
Properties Outputread 2026-09-27Write key and value pairs to a properties file
Talend (1)
tFileOutputPropertiesread 2026-09-27Write key = value pairs to an .ini or .properties file
Background
In Apache Hop, the Properties Output transform writes rows of data to a Java properties file, taking the key from one field and the value from another.[1] An INI (initialisation) file is a configuration file of plain text whose key–value pairs are organised in sections.[2] TOML (Tom's Obvious, Minimal Language) aims to be a minimal configuration file format that is easy to read, designed to map unambiguously to a hash table.[3]
When to use it
In Talend, the tFileOutputProperties component writes a configuration file of the .ini or .properties type, with text data organised as key = value.[4] .properties files are mainly used in Java-related technologies to store the configurable parameters of an application.[5] There is no Request for Comments (RFC) for .properties files, and their specification documents are not always clear.[5]
INI is an informal format, so many varying specifications exist, called INI dialects.[2] INI interpretations vary in whitespace preservation, field type information, case sensitivity and preferred comment delimiters.[2] Find out which parser will read the file, and write for that parser's dialect, quoting and escaping values as it expects. (Meridian's view)
In a .properties file, keys with the same name are overwritten by the key that is furthest down the file.[5] In TOML, defining a key multiple times is invalid.[3] Deduplicate keys before writing a settings file. (Meridian's view) Apache Hop's Properties Output can update an existing properties file, leaving properties that the transform does not process unchanged.[1]
The method
In INI, a section name appears on a line by itself in square brackets, and applies to all key–value pairs on the following lines until another section is declared.[2]
Each line in a .properties file normally stores a single property, written as key=value, key = value, key:value, or a key and value separated by whitespace.[5] In a .properties file, single or double quotes are considered part of the string, and the backslash is used to escape a character.[5]
In TOML, the key, equals sign and value of a key/value pair must be on the same line, though some values can be broken over several lines.[3] TOML basic strings are surrounded by quotation marks, and a quotation mark or backslash inside one must be escaped.[3] TOML tables are defined by headers in square brackets on a line by themselves, and the key/value pairs within a table are not guaranteed to be in any order.[3] TOML is case-sensitive, and a TOML file must be a valid UTF-8 encoded Unicode document.[3]
YAML (YAML Ain’t Markup Language) is a human-friendly, cross-language, Unicode-based data serialisation language, broadly useful for needs that include configuration files.[6] In YAML, the double-quoted style is the only style capable of expressing arbitrary strings, by using backslash escape sequences.[6] The YAML 1.2 specification was published in 2009, and its primary focus was making YAML a strict superset of JSON.[6]
Sources
- [1]Write data to properties file | Apache Hopdocumentation
- [2]INI file - Wikipediasecondary source
- [3]TOML: English v1.0.0standard
- [4]Properties components | Talend Components for Jobs Helpdocumentation
- [5].properties - Wikipediasecondary source
- [6]YAML Ain’t Markup Language (YAML™) revision 1.2.2standard