Skip to main content

CLI Reference

This page provides a comprehensive reference for all Wvlet CLI commands.

wvlet is the single command of every distribution (npm, Homebrew, and the release packages). wvlet with no arguments on a terminal opens the REPL; in a pipe or a script it prints the version. wv is an alias of wvlet repl. Commands marked JVM CLI need the Homebrew or release-package wvlet; the npm wvlet doesn't have them yet.

Global Options​

These options can be used with any command:

wvlet [global options] <command> [command options]
OptionDescription
-h, --helpDisplay help message
--versionDisplay version
--debugEnable debug logging
-l, --loglevel <level>Set log level (error, warn, info, debug, trace)
-L <pattern>=<level>Set log level for specific class patterns

compile, to_wvlet, run, and repl share these options:

OptionDescription
-w <path>Working folder (default: current folder)
-f, --file <path>Read the query from a file
-t, --target <type>Engine: wvlet (default for run and repl), duckdb (default dialect for compile), trino, snowflake, ...
-p, --profile <name>Use a connection profile from ~/.wvlet/profiles.json
--catalog <name>, --schema <name>Override the default engine's catalog and schema
--strictFail compilation on typing errors (compile, to_wvlet, run)

Commands​

wvlet compile​

Compile Wvlet queries to SQL.

wvlet compile [options] [query]

Options:

OptionDescription
-f, --file <path>Compile queries from a file
-t, --target <type>Target database type (duckdb, trino)
--catalog <name>Use specific catalog
--schema <name>Use specific schema
--strictFail compilation on typing errors

Examples:

# Compile inline query
wvlet compile "from users select * limit 10"

# Compile from file
wvlet compile -f queries/analysis.wv

# Compile for specific target
wvlet compile -f query.wv --target trino

wvlet catalog import​

JVM CLI. Import database table schemas as Wvlet type definitions, and engine functions as Wvlet function definitions, for offline query validation. See Importing Database Catalogs.

wvlet catalog import [options]

Options:

OptionDescription
--profile <name>Profile to connect with
--catalog <name>Catalog to import (default: profile catalog)
--schema <name>Import only the specified schema
--path <folder>Output folder (default: catalog)
--no-functionsSkip importing engine functions

Examples:

# Import all schemas of the profile's catalog
wvlet catalog import --profile production

# Import a single schema
wvlet catalog import --profile production --schema sales

wvlet skill​

Print or install the AI-agent skill embedded in this wvlet version, so coding agents read syntax that matches the installed compiler. install, list, and remove accept -a, --agent (claude, codex, pi; default all), -g, --global, --dir, --force, and --json; remove also takes --yes and --dry-run. See Wvlet for AI Agents.

wvlet skill # SKILL.md
wvlet skill syntax # references/syntax.md (also models, testing, cli)
wvlet skill files # list the files
wvlet skill install # install for Claude Code, Codex, and Pi in this project
wvlet skill install -a claude -g # install for Claude Code in ~/.claude/skills
wvlet skill install --dir tools # install into tools/wvlet/
wvlet skill list # show installs and whether they are current
wvlet skill remove -a codex --yes # remove what wvlet installed (--dry-run to preview)

wvlet install​

JVM CLI. Install the JDBC driver of the DuckDB or Snowflake connector, which wvlet otherwise downloads the first time a query uses the connector. With no name, list the drivers and whether they are installed. See Adding DuckDB or Snowflake.

wvlet install duckdb
wvlet install snowflake
wvlet install

wvlet run​

Run Wvlet queries and display results.

wvlet run [options] [query]

Options:

OptionDescription
-f, --file <path>Run queries from a file
-t, --target <type>Engine to run on: wvlet (the in-process wvlet engine, default without --profile), duckdb, trino
-p, --profile <name>Run with a connection profile
--catalog <name>, --schema <name>Override the default engine's catalog and schema
--format <type>Output format: box (default, the first 40 rows; on the wvlet engine, results of more than 10,000 rows are not counted to the end) or csv (every row of the last result)
--host, --port, --user, --httpsConnect to a Trino coordinator, or with -t wvlet to a remote wvlet server. Passwords and tokens come from the profile only

A failed test assertion or statement makes wvlet run exit with status 1 after printing all results.

Examples:

# Run inline query
wvlet run "from users select count(*)"

# Run from file
wvlet run -f queries/report.wv

# Print the result as CSV
wvlet run -f query.wv --format csv

wvlet repl​

Start the interactive REPL. A bare wvlet on a terminal does the same.

wvlet repl [-p <profile>] [-t <engine>] [-c <command>] [-f <file>]

-c runs a command and exits, -f runs the commands in a file and exits.

wvlet build​

Build materialized models in dependency order. The npm and Native wvlet build one model at a time; see Model Pipelines for what only the JVM CLI does.

wvlet build [options]

Options:

OptionDescription
-w <folder>Project folder with .wv files (default: current folder)
-s, --select <selectors>Models to build, comma-separated: m, m+ (with downstream), +m (with upstream)
--dry-runPrint the build order and SQL without running anything
-p, --profile <name>Profile to use
-t, --target <engine>Engine to use without a profile: wvlet (default), duckdb, ...
--catalog <name>, --schema <name>Context catalog and schema
--run-store <type>JVM CLI. Store of run records: file (default), sqlite, or postgres

Examples:

# Build every materialized model
wvlet build

# Build a model and everything downstream of it
wvlet build -s stg_orders+

wvlet server​

JVM CLI. Start the wvlet server: it runs queries for remote clients and serves the web UI. It needs JDK 25 or later, which Homebrew and the platform packages bundle.

wvlet server [options]

Options:

OptionDescription
-p, --port <port>Server port (default: 9090)
--openOpen the web UI in a browser (macOS)
--tpchLoad small demo TPC-H tables
--auth-token <token>Require this bearer token on RPC requests (or set WVLET_SERVER_TOKEN)
--max-running-queries <n>Queries running at once; others wait in the queue (default: half the CPUs)
--max-queued-queries <n>Queries waiting to run; submissions past it fail with RESOURCE_EXHAUSTED (default: 1000). See Remote Wvlet Server
--max-query-memory <size>Memory one wvlet-engine query may hold, e.g. 2GB, before it fails with RESOURCE_EXHAUSTED (default: no limit)
--memory-pool-size <size>Memory wvlet-engine queries may hold together before queued queries wait (default: 70% of the heap)
--low-memory-killer-delay <duration>How long wvlet-engine queries may stay over the memory pool size, with more than one running, before the one holding the most memory fails with RESOURCE_EXHAUSTED, e.g. 10s or off (default: 5s)
--allow-remote <prefix>Let queries read remote files under this prefix, e.g. s3://bucket/sales/ or https://data.example.com/. Repeatable (default: nothing remote). See Remote files
--allow-driver-installLet queries install a missing JDBC driver (DuckDB, Snowflake) on first use (default: off). See Adding DuckDB or Snowflake

Examples:

# Start the server on the default port 9090
wvlet server

# Start on a custom port and open the web UI
wvlet server --port 9000 --open

Configuration​

Profile Configuration​

Create profiles in ~/.wvlet/profiles.json (parsed as JSONC: comments and trailing commas are allowed, and ${ENV_VAR} references are expanded from the environment). A profile describes a working environment with one or more named connectors; the connector marked "default": true (or the first one) is the engine queries run on:

{
"profiles": [
{
"name": "local",
"connectors": [
{ "name": "duckdb", "type": "duckdb", "catalog": "memory", "schema": "main" }
]
},
{
"name": "production",
"connectors": [
{
"name": "trino",
"type": "trino",
"default": true,
"host": "trino.example.com:8080",
"catalog": "production",
"schema": "analytics",
"user": "myuser",
"password": "${TRINO_PASSWORD}"
},
{ "name": "local", "type": "duckdb", "catalog": "memory", "schema": "main" }
]
}
]
}

Use profiles with --profile option:

wvlet run -f query.wv --profile production

Environment Variables​

VariableDescription
WVLET_HOMEWvlet home directory (default: ~/.wvlet)
WVLET_LOG_LEVELDefault log level
WVLET_DB_TYPEDefault database type
WVLET_NO_DRIVER_INSTALLSet to 1 to stop downloading a missing JDBC driver on first use
WVLET_DRIVER_DIRWhere JDBC drivers are installed (default: ~/.wvlet/drivers)
WVLET_MAVEN_REPOMaven Central mirror for JDBC driver downloads

The wv alias​

wv is an alias of wvlet repl, kept for existing scripts. It takes the same options:

# Start the REPL (same as a bare `wvlet` on a terminal)
wv

# Run one command and exit
wv -c "from users select count(*)"

Examples​

Typical Development Workflow​

# 1. Write and test queries
wvlet compile -f query.wv

# 2. Run queries against database
wvlet run -f query.wv

# 3. Start the server and its web UI for interactive development
wvlet server --open

CI/CD Pipeline Example​

#!/bin/bash
# ci-validate-queries.sh

# Validate query syntax
find queries -name "*.wv" | while read file; do
echo "Validating: $file"
wvlet compile -f "$file"
done

Batch Processing Example​

# Process multiple queries
for query in daily/*.wv; do
output="${query%.wv}.sql"
wvlet compile -f "$query" > "$output"
echo "Generated: $output"
done

# Run all reports
for report in reports/*.wv; do
name=$(basename "$report" .wv)
wvlet run -f "$report" --format csv > "output/${name}.csv"
done

See Also​