Skip to content

File schemas ​

An input format describes bytes; the target schema determines how those bytes become typed SQL values. Create an explicit destination table for INSERT FORMAT.

Most server file() sources also require a third argument containing a column/type list, including CSV, JSON, Arrow, Parquet and Avro. A container's stored schema does not replace this requirement in CoordinatorDB.

Sources with column metadata ​

Two formats can provide file-source columns without the schema argument:

  • form infers String columns from its field names. Empty input needs an explicit schema.
  • parquet_metadata exposes a fixed schema describing the file footer.

Form keys are literal field names; its values are URL-decoded. An explicit supplied schema follows ordinary conversions and cannot contain column constraints or DEFAULT expressions.

Examples ​

text
SELECT * FROM file('people.csv', csv, 'id UInt64, name String');
SELECT * FROM file('fields.form', form);
SELECT num_rows FROM file('sample.parquet', parquet_metadata);

The files must exist under the configured server file root. See file, form and Parquet metadata.