Tables — CLI Guide
Two dodil k3 command groups cover the Tables domain:
dodil k3 table— table lifecycle + SQL + data mutations + maintenance. Most of your time is here.dodil k3 engine— per-bucket engine lifecycle. Engine is auto-enabled onCreateBucket— you rarely touch these.
For navigation, this guide splits the table subcommands into three pages by concern:
| Page | Subcommands | Maps to API |
|---|---|---|
dodil k3 table — lifecycle | create · list · get · describe · delete | Tables |
dodil k3 table — data | query · insert · merge · update · delete-rows | Data + Execute |
dodil k3 table — maintenance | optimize · vacuum · compact | Maintenance |
dodil k3 engine | enable · get · disable | Engine |
For install, auth, output format, and global flags see CLI Basics. For the underlying API contracts see Tables — API Reference.
Quick session
# 0. (Engine is already enabled — every bucket gets one on CreateBucket.)
# Skip straight to creating a table.
dodil k3 table create events --bucket kb-prod \
--columns-json '[
{"name":"id","type":"COLUMN_TYPE_LONG","nullable":false},
{"name":"user_id","type":"COLUMN_TYPE_STRING","nullable":false},
{"name":"event_type","type":"COLUMN_TYPE_STRING","nullable":false},
{"name":"payload","type":"COLUMN_TYPE_JSON","nullable":true}
]' \
--partition-column event_type \
--merge-key id --merge-key user_id
# 1. Insert
dodil k3 table insert events --bucket kb-prod \
--row '{"id":1,"user_id":"u-101","event_type":"click","payload":{"page":"/pricing"}}' \
--row '{"id":2,"user_id":"u-102","event_type":"purchase","payload":{"sku":"A-12"}}'
# 2. Query (eventual freshness)
dodil k3 table query "SELECT event_type, COUNT(*) AS n FROM events GROUP BY event_type" \
--bucket kb-prod
# 3. Upsert with MERGE semantics
dodil k3 table merge events --bucket kb-prod \
--match-column id --match-column user_id \
--row '{"id":1,"user_id":"u-101","event_type":"click_pricing","payload":{"page":"/pricing","variant":"B"}}'
# 4. Drain write log to Delta + bin-pack
dodil k3 table compact events --bucket kb-prod
dodil k3 table optimize events --bucket kb-prodSee the Quickstart for the same flow with prose annotations.
CLI surface vs API surface
The CLI covers the most-common operations. Anything missing has a direct HTTP equivalent in the API Reference.
| Domain | API coverage | CLI coverage | Use API directly for |
|---|---|---|---|
| Engine | EnableEngine · GetEngine · DisableEngine | full | — ✅ complete |
| Table lifecycle | CreateTable · CreateTablePipeline · ListTables · GetTable · DeleteTable · AlterTable · DescribeTable · ListPartitions | create (manual + pipeline) · list · get · describe · delete | AlterTable (ADD COLUMN), ListPartitions — use curl against /:bucket/tables/:name/{schema,partitions} |
| Data | Query · Insert · Merge · Update · DeleteRows | full | Query.freshness selector — CLI hardcodes default (eventual) |
| SQL planner | Execute (full DuckDB SQL) · Materialize | partial — table query runs reads via the same dispatcher | DDL via Execute (CREATE / ALTER / DROP / CTAS), Materialize, write SQL strings via Execute |
| Maintenance | Optimize · Vacuum · Compact · Restore · History | optimize · vacuum · compact | Restore, History — use API |
| Templates (warehouse-compatible) | ListTemplates | table templates — org-scoped (no -b needed); --category / --search / --label server-side filters | — ✅ complete |
Global flags worth knowing
All dodil k3 table and dodil k3 engine subcommands take:
| Flag | Short | Required | Description |
|---|---|---|---|
--bucket | -b | yes (persistent on the group) | Bucket the engine / table lives in |
--output | -o | no | table (default) · json — pick json for piping into jq |
For the full set of global flags (--api-endpoint, --token, --org, --timeout, etc.) see CLI Basics → Global Flags.
See also
- API Reference — full Tables API surface
- Quickstart — first table → first INSERT → first query
- Core Concepts — Engine, Table, Column, strategies, freshness, history
- SQL Compatibility — DuckDB dialect + statement shapes