Skip to content

form ​

Description ​

One application/x-www-form-urlencoded record: key=value&key=value. Percent escapes and plus-as-space decoding apply to values. file() can infer String columns when no explicit schema is supplied.

Only values are URL-decoded; keys retain their literal spelling, including dots and percent sequences. Repeated keys are rejected, ignoring ASCII case. A final LF or CRLF may terminate the record.

Input only. Select it with FORMAT form. Names ignore ASCII case; use the snake_case name shown here.

The input represents one row of key/value pairs, rather than a stream of several records. Values decode percent escapes and plus signs; keys keep their literal spelling. Repeated keys are rejected without regard to ASCII case.

A file() source can infer String fields from nonempty input. Supply an explicit schema to choose native conversions or to describe an empty form. The format has no output encoder.

text
INSERT INTO table [(columns)] [SETTINGS ...] FORMAT form
<data>

Example usage ​

sql
SELECT name,is_input,is_output FROM system.formats WHERE name='form' FORMAT csv;
text
"form",1,0

Example input: id=7&name=Ada+Lovelace.

Format settings ​

Use a statement SETTINGS clause; these options are not persisted by SET.

Setting Type Default Meaning
ignore_unknown_fields Bool 0 Skip input keys and header names that match no target column instead of failing.
snappy_mode String basic Read Snappy client files as basic (Hadoop blocks) or framed (standard streaming format).

Load rows ​

Run the INSERT request separately; its remaining bytes are input data.

sql
CREATE TABLE form_input(id UInt8,name String);
text
OK
sql
INSERT INTO form_input FORMAT form
id=7&name=Ada+Lovelace
text
OK
sql
SELECT * FROM form_input FORMAT csv;
text
7,"Ada Lovelace"