parquet.q

Read and write parquet files through DuckDB: .parquet.read answers a table, .parquet.write writes one, and the schema, metadata, file_metadata, kv_metadata and bloom_probe verbs answer DuckDB's own inspection tables. `select from `:x.parquet` and `:x.parquet set t are the shortest spellings; save `t.parquet also works. A file written from a q table carries its q types in the key-value metadata, so it reads back as written; a foreign file comes back as DuckDB reads it (text is text, never symbols). A URL (s3:// ...) passes straight through.

Examples

.parquet.write[`:trade.parquet;([] sym:`a`b; px:1.5 2.5);()]
.parquet.read[`:trade.parquet;();()]
select from `:trade.parquet where px>2

Entity Summary

EntitiesShort Description
.parquet.bloom_probe[file;column;val]Per row group, whether the bloom filter on a column excludes a value: DuckDB's parquet_bloom_probe.
.parquet.file_metadata[file]The file-level metadata: created_by, num_rows, num_row_groups, format_version, encryption_algorithm.
.parquet.kv_metadata[file]The file's key-value metadata, one row per key (a q-written file carries q_schema).
.parquet.metadata[file]One row per column chunk per row group: DuckDB's parquet_metadata.
.parquet.read[file;opts;query]Read a parquet file (or files) as a table, optionally through a select pushed down to DuckDB.
.parquet.schema[file]The file's schema: one row per column, DuckDB's parquet_schema columns verbatim.
.parquet.write[file;table;opts]Write a table to a parquet file and answer the file.

Entity Details

.parquet.bloom_probe[file;column;val]

Per row group, whether the bloom filter on a column excludes a value: DuckDB's parquet_bloom_probe.

Examples

.parquet.bloom_probe[`:t.parquet;`a;1]

.parquet.file_metadata[file]

The file-level metadata: created_by, num_rows, num_row_groups, format_version, encryption_algorithm.

Examples

.parquet.file_metadata `:t.parquet

.parquet.kv_metadata[file]

The file's key-value metadata, one row per key (a q-written file carries q_schema).

Examples

.parquet.kv_metadata `:t.parquet

.parquet.metadata[file]

One row per column chunk per row group: DuckDB's parquet_metadata.

Examples

select path_in_schema, row_group_id, num_values from .parquet.metadata `:t.parquet

.parquet.read[file;opts;query]

Read a parquet file (or files) as a table, optionally through a select pushed down to DuckDB.

Parameters:
  • file - `:x.parquet, a glob as `$":data/*.parquet", a URL, or a list of them
  • opts - a dict of read_parquet options passed verbatim (hive_partitioning, union_by_name, filename ...); () for none
  • query - () or :: for every row, else a parsed select tree (parse "select ... from t") whose table is ignored
throws: type query is not a select tree

Examples

.parquet.read[`:t.parquet;();()]
.parquet.read[`$":t/*/*.parquet";(enlist `hive_partitioning)!enlist 1b;()]
.parquet.read[`:t.parquet;();parse "select sum a from t where a>1"]

.parquet.schema[file]

The file's schema: one row per column, DuckDB's parquet_schema columns verbatim.

Examples

.parquet.schema `:t.parquet

.parquet.write[file;table;opts]

Write a table to a parquet file and answer the file. A DuckDB-backed table copies in place; any other table is staged through the main DuckDB database first.

Parameters:
  • file - `:out.parquet, a directory `:out/ with partition_by, or a URL
  • opts - a dict of COPY options passed verbatim (compression, row_group_size, partition_by, field_ids ...): a symbol list is an identifier list, a dict a struct; () for none
throws: type file is not a symbol, or table is not a table

Examples

.parquet.write[`:t.parquet;([] a:1 2);(enlist `compression)!enlist `zstd]
.parquet.write[`:t/;([] d:2026.01.01 2026.01.02; a:1 2);(enlist `partition_by)!enlist `d]