Skip to content

dql tools

Synopsis

dql tools <subcommand> [options] <query>
dql t <subcommand> [options] <query>

Description

Tools for ad-hoc data ingestion and munging. Each subcommand loads data from stdin or files into temporary tables, then runs a DelightQL query against them.

Subcommands

jstruct (alias: j)

Read JSON from stdin into a single-column table j(j TEXT), then query it.

dql tools jstruct [options] <query>
# Query JSON data
curl -s https://api.example.com/users | dql t j "j(*)"

# Extract fields with DQL
cat data.json | dql t j "j(json_extract(j, '$.name') -> name)"

Options:

-f, --format fmt
Output format: table, json, csv, tsv.

--to stage
Pipeline stage (same values as dql query --to).

csvstruct (alias: c)

Read CSV from stdin into a table, then query it.

dql tools csvstruct [options] <query>
cat data.csv | dql t c --has-headers "c(*)"

Options:

--has-headers
First row is column headers.

--delimiter char
Field delimiter. Default: ,.

-f, --format fmt
Output format: table, json, csv, tsv.

--to stage
Pipeline stage (same values as dql query --to).

filemunge (alias: m)

Load tables from multiple files, then query across them.

dql tools filemunge [options] <query>
dql t m \
    --table users:csv users.csv \
    --table orders:json orders.json \
    "users(*) |> join(orders, users.id = orders.user_id)"

Options:

--table spec path
Table specification and file path. Spec format: name:format[:noheader]. Formats: csv, tsv, json-singleton. CSV/TSV default to having headers; append :noheader to override. May be repeated.

-f, --format fmt
Output format: table, json, csv, tsv.

--to stage
Pipeline stage (same values as dql query --to).

See Also

dql(1), dql-query(1)