nbadbArena Data Lab
Core DocsArena MapCLI Reference20 waypoints

Jump Ball

CLI Reference

Command matrix and operator notes for the current nbadb CLI surface.

CLI Reference

Treat this page like the sideline play sheet for nbadb. It is the fastest route from “what command do I need?” to “what exactly does that command accept?” without reading the CLI code directly.

CLI commands
14
current Typer command surface registered by the app
Pipeline run modes
4
init, daily, monthly, and full
Default exports
4
sqlite, duckdb, csv, and parquet
Status JSON keys
3
watermarks, journal, and metadata

Quick navigation

Entry surface

Build or refresh data

Start with Pipeline commands if you are deciding between init, daily, monthly, and full.

Entry surface

Inspect or debug a dataset

Jump to

Inspection and quality commands

for schema, status, and run-quality.

Entry surface

Move data in or out

Use

Distribution and artifact commands

for export, download, upload, and docs-autogen.

Entry surface

Need exact flags

Skip to Full command matrix when the only question is the literal current signature.

Opening possessions

GoalCommand
Build the full historical datasetnbadb init
Refresh the current season after games settlenbadb daily
Sweep the last 3 seasons more broadlynbadb monthly
Retry failures and fill historical gapsnbadb full
Re-export from the existing DuckDB databasenbadb export
Inspect pipeline statenbadb status
Regenerate generated docs artifactsnbadb docs-autogen
Download or publish the Kaggle datasetnbadb download / nbadb upload

Choose the command family first

If your question is…Start hereTypical commands
“How do I build or refresh data?”Pipeline commandsinit, daily, monthly, full
“How do I inspect, validate, or debug what already exists?”Inspection and quality commandsschema, status, run-quality, ask
“How do I move artifacts in or out?”Distribution and artifact commandsexport, download, upload, docs-autogen, extract-completeness, migrate
“What are the exact current signatures?”Exact signaturesGrouped tables for every current command
Command modules

Pipeline commands

These are the commands most operators touch first.

Historical build

`nbadb init`

Full rebuild across historical seasons. Supports --season-start/-s, --season-end/-e, repeatable --format/-f, --data-dir/-d, --verbose/-v, and --quality-check.

Current-season refresh

`nbadb daily`

Uses the current season plus the NBADB_DAILY_LOOKBACK_DAYS window, refreshes active players and teams, then rebuilds downstream tables in replace mode.

Recent multi-season sweep

`nbadb monthly`

Refreshes the last 3 seasons and then rebuilds downstream tables in replace mode.

Recovery run

`nbadb full`

Retries failed extractions first, then scans the full season range while skipping work already recorded as extracted.

Run modes that matter most

CommandPrimary intentScope
nbadb initFull historical buildHistorical seasons from --season-start through --season-end
nbadb dailyCurrent-season refresh focused on recent gamesCurrent season, recent games within NBADB_DAILY_LOOKBACK_DAYS, plus active player/team refresh
nbadb monthlyBroader refresh of recent historyThe last 3 seasons
nbadb fullRetry failures and fill historical gapsFailed journal entries first, then a resume-safe historical scan

daily, monthly, and full are not lightweight star-surface upsert commands. Their extraction scope differs, but each run ends by rebuilding downstream tables in replace mode.

Inspection and quality commands

Discovery

`nbadb schema [TABLE]`

With no argument, it lists discovered output tables grouped by prefix. With an optional table argument, it shows lineage-style details for that table.

Operational state

`nbadb status`

Shows pipeline watermarks, journal summary, and pipeline metadata. Use --output-format json for CI or scripts.

Quality checks

`nbadb run-quality`

Runs quality checks against the existing DuckDB database and can write a JSON report with --report-path.

Local query agent

`nbadb ask QUESTION`

Sends a natural-language question to the local query agent with --limit/-l and an accepted-but-currently-nonfunctional --verbose/-v flag.

nbadb status

Use --output-format json for scripts and CI. The JSON payload contains three top-level keys:

{
  "watermarks": [],
  "journal": {},
  "metadata": []
}

nbadb run-quality

  • --report-path writes a machine-readable JSON report and creates parent directories as needed.
  • The command exits non-zero when the database is missing, when no checks ran, or when the command errors.
  • Current limitation: failed quality checks are reported, but they do not currently force a non-zero exit code once checks have executed. If CI must fail on bad results, parse the JSON report and gate on summary.failed > 0.

Distribution and artifact commands

CommandWhat it is forNotes
nbadb exportRe-export public tables from DuckDBUses repeatable --format/-f; defaults come from NBADB_FORMATS
nbadb downloadPull the latest published Kaggle dataset into the data directorySeeds nba.duckdb from nba.sqlite if DuckDB is missing
nbadb uploadPublish the data directory to KaggleEnsures dataset-metadata.json exists first
nbadb docs-autogenRegenerate generated docs artifactsDefaults --docs-root to docs/content/docs
nbadb extract-completenessGenerate endpoint coverage artifactsSupports --output-dir/-o, --require-full, and --require-model-contract
nbadb migrateCreate or migrate pipeline tablesUsually a setup or recovery command

nbadb extract-completeness

By default this writes coverage artifacts to artifacts/endpoint-coverage/:

  • endpoint-coverage-matrix.json
  • endpoint-coverage-summary.json
  • endpoint-coverage-report.md

Pass --output-dir to change the destination.

Use --require-full in CI to fail when any of these source-coverage gaps remain non-zero:

  • runtime_gap
  • staging_only
  • extractor_only
  • source_only

Use --require-model-contract to fail when a staged stats surface has neither downstream transform ownership nor an explicit exclusion decision. The command summary also prints model-ownership counts so you can distinguish owned, excluded, and still-unowned surfaces.

That endpoint-level contract is intentionally separate from the output-schema audit. The same summary now prints star schema coverage counts for transform outputs so you can see, independently, how many tables have a schema-backed final-tier contract versus how many still bypass star-schema validation.

nbadb docs-autogen

Use this when generated reference pages drift from code:

uv run nbadb docs-autogen --docs-root docs/content/docs

It regenerates:

  • schema/{raw,staging,star}-reference.mdx
  • data-dictionary/{raw,staging,star}.mdx
  • diagrams/er-auto.mdx
  • lineage/lineage-auto.mdx
  • lineage/lineage.json

The same generator is also available via:

uv run python -m nbadb.docs_gen --docs-root docs/content/docs

The command prints updated: or unchanged: for each artifact, then a final summary line.

Shared behavior for pipeline commands

These notes apply to nbadb init, daily, monthly, and full.

  • --data-dir overrides the default data directory (nbadb/) and the NBADB_DATA_DIR setting.
  • --quality-check runs post-pipeline quality checks against the DuckDB file, but those checks are informational today: empty-table warnings are reported without failing the command.
  • If stdout is an interactive terminal and --verbose is not set, the CLI uses the Textual TUI.
  • Use --verbose to force plain log output and DEBUG-level logging.
  • A single Ctrl+C attempts a graceful stop and preserves resume-safe journal/checkpoint state; pressing Ctrl+C again forces exit.
  • Successful runs print a summary like this:
daily: 12 tables, 245,901 rows, 38.4s

Shared flags and defaults that matter most

Flag or defaultApplies toWhat to remember
--data-dir/-dMost commands that read or write local dataOverrides the default nbadb/ directory and the NBADB_DATA_DIR setting
--format/-finit and exportRepeatable; defaults come from NBADB_FORMATS when omitted
--verbose/-vPipeline commands and askOn pipeline commands, it forces plain logs and DEBUG-level output instead of the TUI
--quality-checkinit, daily, monthly, fullRuns informational post-pipeline quality checks without currently failing on empty-table warnings
--output-format/-fstatustext by default; use json for CI and scripts

Data and output defaults

  • Default export formats come from NbaDbSettings.formats: sqlite, duckdb, csv, and parquet.
  • nbadb init and nbadb export use all configured formats when you omit --format.
  • nbadb download copies the Kaggle dataset into the target data directory and seeds nba.duckdb from nba.sqlite if only SQLite is present.
  • nbadb upload ensures dataset-metadata.json exists before publishing.
  • nbadb schema groups tables by output prefix. Analysis-ready convenience outputs use the analytics_* prefix.
Exact signatures

Full command matrix

The matrix below mirrors the current Typer command signatures in src/nbadb/cli/commands.

Pipeline commands

CommandWhat it doesPositional argsOptions
nbadb initFull rebuild across historical seasons--data-dir/-d, --format/-f (repeatable), --season-start/-s (default: 1946), --season-end/-e, --verbose/-v, --quality-check
nbadb dailyCurrent-season refresh focused on recent games--data-dir/-d, --verbose/-v, --quality-check
nbadb monthlyRefresh the last 3 seasons--data-dir/-d, --verbose/-v, --quality-check
nbadb fullRetry failed extractions and fill historical gaps--data-dir/-d, --verbose/-v, --quality-check

Inspection and quality commands

CommandWhat it doesPositional argsOptions
nbadb schema [TABLE]List all discovered output tables or show lineage for one tableoptional TABLE
nbadb statusShow pipeline status, watermarks, and metadata--data-dir/-d, --output-format/-f (default: text; json supported)
nbadb run-qualityRun quality checks against the existing DuckDB database--data-dir/-d, --report-path
nbadb ask QUESTIONAsk the local query agent a natural-language questionrequired QUESTION--limit/-l (default: 10), --verbose/-v

Distribution and artifact commands

CommandWhat it doesPositional argsOptions
nbadb exportRe-export user tables from DuckDB into configured output formats--data-dir/-d, --format/-f (repeatable)
nbadb downloadDownload the latest Kaggle dataset into the data directory--data-dir/-d
nbadb uploadUpload the dataset directory to Kaggle--data-dir/-d, --message/-m (default: "Automated update")
nbadb migrateCreate or migrate pipeline tables--data-dir/-d
nbadb docs-autogenRegenerate generated docs artifacts under the docs content tree--docs-root (default: docs/content/docs)
nbadb extract-completenessGenerate endpoint coverage artifacts--output-dir/-o, --require-full, --require-model-contract

Keep moving

Stay in the same possession

Keep the mental model warm with adjacent pages, section hubs, and search-friendly routes into the same topic cluster.

Section hub

On this page