context verify
The verify command compares your context files against a live database to detect drift — columns that were added, removed, or changed since the last introspection.
context verify --db <connection-url>Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
--source <name> | Use a specific data_source from config | First configured source |
--db <url> | Database URL override (postgres:// or path.duckdb) | — |
--context-dir <path> | Path to context files | ./context |
--format <type> | Output format: pretty, json | pretty |
Examples
Section titled “Examples”Verify all sources
Section titled “Verify all sources”context verify --db postgres://localhost:5432/myappVerify a specific source
Section titled “Verify a specific source”context verify --db postgres://localhost:5432/myapp --source analyticsJSON output for scripting
Section titled “JSON output for scripting”context verify --db postgres://localhost:5432/myapp --format jsonExample output
Section titled “Example output”Verifying against postgres://localhost:5432/myapp...
context/public/users.context.yaml ✓ All columns match
context/public/orders.context.yaml ✗ Column "discount_code" exists in DB but missing from context ✗ Column "legacy_status" in context but not found in DB ✗ Column "total" type mismatch: context says "integer", DB says "numeric(10,2)"
context/public/sessions.context.yaml ✗ Table "sessions" not found in database
Summary: 1 passed, 2 drifted, 1 missingWhat it checks
Section titled “What it checks”The verify command connects to your database, introspects tables, columns, sample values, golden queries, and guardrail filters, then runs all data/* lint rules against the results. This catches issues like missing tables, missing columns, type mismatches, stale sample values, and failing golden queries.
CI integration
Section titled “CI integration”# Fail the build if context has driftedcontext verify --db "$DATABASE_URL" --format json | jq -e '.drifted == 0'Fixing drift
Section titled “Fixing drift”When drift is detected, you have two options:
# Re-introspect to pick up DB changes (overwrites manual edits)context introspect --db postgres://localhost/myapp --tables "orders"
# Or manually update the context file to match# Then verify againcontext verify --db postgres://localhost/myappNext steps
Section titled “Next steps”- Re-introspect drifted tables with
context introspect - Re-enrich after updating with
context enrich