Docs/Commands/data
ProEnterprisegenerated from cli/_parser_setup.py

dblift data

Audited DML for one-off corrections. new, plan, apply and status are Pro. undo — restoring before-images captured at apply, including a direct child row — is Enterprise. Corrections live in named data sets in your config; every apply is written to an audit ledger. See Data corrections.

Synopsis

$ dblift data {new,plan,apply,status,undo} ...

Options

FlagDescription

No command-specific options. Global flags still apply.

What each licence unlocks

The data command itself is Pro. new, plan, apply and status run on Pro; undo and the capture that makes undo possible are Enterprise. A Pro apply still records the ledger — without Enterprise it just has nothing to reverse. Enterprise undo restores a direct child row changed by a one-level cascade. It does not restore a deeper cascade or a parent-key change.

SubcommandLicence
newPro. Writes a file. No database.
planPro. Verdicts and plan-time policy checks. No row data.
applyPro. Before/after image capture for undo is Enterprise.
statusPro
undoEnterprise. Direct child rows only.

Subcommands

planPro

Build a static, reviewable plan from pending correction files. Reports triggers, foreign-key children, an undo verdict, and plan-time policy violations. The plan contains no row data.

dblift data plan [-h] --dataset DATASET [--output OUTPUT]
                        [--format {text,json}]
--datasetData set name (from dblift.yaml data_sets)
--output, -oWrite plan JSON
--formatOutput format (default: text)

applyPro

Execute a reviewed plan file, enforce row-count expectations, and write the audit ledger. Before/after image capture for undo is Enterprise.

dblift data apply [-h] [--force] [--format {text,json}] plan_file
plan_filePath to plan.json from 'data plan'
--formatOutput format (default: text)

statusPro

List each correction in the data set and verify the audit ledger.

dblift data status [-h] --dataset DATASET [--format {text,json}]
--formatOutput format (default: text)

newPro

Create a correction file. Never overwrites an existing file and does not open a database.

dblift data new [-h] [--dataset DATASET] [--table TABLE]
                       [--expect EXPECT] [--onfail {halt,skip,warn}]
                       [--format {text,json}]
                       description
descriptionShort description; becomes the file name slug
--datasetData set name (from dblift.yaml data_sets)
--tableTable to put in the placeholder statement
--expectDefault expect= directive (1, >=N, <=N, any)
--onfailDefault onfail= directive
--formatOutput format (default: text)

undoEnterprise

Reverse one applied correction by restoring the before-images captured when it was applied. Requires an Enterprise licence and images from that apply.

dblift data undo [-h] --dataset DATASET [--force]
                        [--format {text,json}]
                        id
--formatOutput format (default: text)

Global flags apply to every command: --config, --env, --scripts, --dry-run, --quiet, --log-level. See global flags.

Examples

Pro — scaffold a correction file. Refuses to overwrite.

$ dblift data new "activate user" --dataset customer_risk

Pro — produce a plan a reviewer can read, with no row data in it

$ dblift data plan --dataset customer_risk --output plan.json

Pro — apply the reviewed plan

$ dblift data apply plan.json

Pro — read the audit ledger as JSON

$ dblift data status --dataset customer_risk --format json

Enterprise — reverse a correction by its ledger id

$ dblift data undo 7f3c1e --dataset customer_risk

Exit codes

CodeMeaning
0Command completed successfully
4A paid-edition feature was invoked without a valid licence (EXIT_LICENSE_REQUIRED)
On this page