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.
Quick navigation
Build or refresh data
Start with Pipeline commands if you are
deciding between init, daily, monthly, and full.
Inspect or debug a dataset
Move data in or out
Need exact flags
Skip to Full command matrix when the only question is the literal current signature.
Opening possessions
| Goal | Command |
|---|---|
| Build the full historical dataset | nbadb init |
| Refresh the current season after games settle | nbadb daily |
| Sweep the last 3 seasons more broadly | nbadb monthly |
| Retry failures and fill historical gaps | nbadb full |
| Re-export from the existing DuckDB database | nbadb export |
| Inspect pipeline state | nbadb status |
| Regenerate generated docs artifacts | nbadb docs-autogen |
| Download or publish the Kaggle dataset | nbadb download / nbadb upload |
Choose the command family first
| If your question is… | Start here | Typical commands |
|---|---|---|
| “How do I build or refresh data?” | Pipeline commands | init, daily, monthly, full |
| “How do I inspect, validate, or debug what already exists?” | Inspection and quality commands | schema, status, run-quality, ask |
| “How do I move artifacts in or out?” | Distribution and artifact commands | export, download, upload, docs-autogen, extract-completeness, migrate |
| “What are the exact current signatures?” | Exact signatures | Grouped tables for every current command |
Pipeline commands
These are the commands most operators touch first.
`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.
`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.
`nbadb monthly`
Refreshes the last 3 seasons and then rebuilds downstream tables in replace mode.
`nbadb full`
Retries failed extractions first, then scans the full season range while skipping work already recorded as extracted.
Run modes that matter most
| Command | Primary intent | Scope |
|---|---|---|
nbadb init | Full historical build | Historical seasons from --season-start through --season-end |
nbadb daily | Current-season refresh focused on recent games | Current season, recent games within NBADB_DAILY_LOOKBACK_DAYS, plus active player/team refresh |
nbadb monthly | Broader refresh of recent history | The last 3 seasons |
nbadb full | Retry failures and fill historical gaps | Failed 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
`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.
`nbadb status`
Shows pipeline watermarks, journal summary, and pipeline metadata. Use
--output-format json for CI or scripts.
`nbadb run-quality`
Runs quality checks against the existing DuckDB database and can write a
JSON report with --report-path.
`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-pathwrites 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
| Command | What it is for | Notes |
|---|---|---|
nbadb export | Re-export public tables from DuckDB | Uses repeatable --format/-f; defaults come from NBADB_FORMATS |
nbadb download | Pull the latest published Kaggle dataset into the data directory | Seeds nba.duckdb from nba.sqlite if DuckDB is missing |
nbadb upload | Publish the data directory to Kaggle | Ensures dataset-metadata.json exists first |
nbadb docs-autogen | Regenerate generated docs artifacts | Defaults --docs-root to docs/content/docs |
nbadb extract-completeness | Generate endpoint coverage artifacts | Supports --output-dir/-o, --require-full, and --require-model-contract |
nbadb migrate | Create or migrate pipeline tables | Usually a setup or recovery command |
nbadb extract-completeness
By default this writes coverage artifacts to artifacts/endpoint-coverage/:
endpoint-coverage-matrix.jsonendpoint-coverage-summary.jsonendpoint-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_gapstaging_onlyextractor_onlysource_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/docsIt regenerates:
schema/{raw,staging,star}-reference.mdxdata-dictionary/{raw,staging,star}.mdxdiagrams/er-auto.mdxlineage/lineage-auto.mdxlineage/lineage.json
The same generator is also available via:
uv run python -m nbadb.docs_gen --docs-root docs/content/docsThe 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-diroverrides the default data directory (nbadb/) and theNBADB_DATA_DIRsetting.--quality-checkruns 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
--verboseis not set, the CLI uses the Textual TUI. - Use
--verboseto force plain log output and DEBUG-level logging. - A single
Ctrl+Cattempts a graceful stop and preserves resume-safe journal/checkpoint state; pressingCtrl+Cagain forces exit. - Successful runs print a summary like this:
daily: 12 tables, 245,901 rows, 38.4sShared flags and defaults that matter most
| Flag or default | Applies to | What to remember |
|---|---|---|
--data-dir/-d | Most commands that read or write local data | Overrides the default nbadb/ directory and the NBADB_DATA_DIR setting |
--format/-f | init and export | Repeatable; defaults come from NBADB_FORMATS when omitted |
--verbose/-v | Pipeline commands and ask | On pipeline commands, it forces plain logs and DEBUG-level output instead of the TUI |
--quality-check | init, daily, monthly, full | Runs informational post-pipeline quality checks without currently failing on empty-table warnings |
--output-format/-f | status | text by default; use json for CI and scripts |
Data and output defaults
- Default export formats come from
NbaDbSettings.formats:sqlite,duckdb,csv, andparquet. nbadb initandnbadb exportuse all configured formats when you omit--format.nbadb downloadcopies the Kaggle dataset into the target data directory and seedsnba.duckdbfromnba.sqliteif only SQLite is present.nbadb uploadensuresdataset-metadata.jsonexists before publishing.nbadb schemagroups tables by output prefix. Analysis-ready convenience outputs use theanalytics_*prefix.
Full command matrix
The matrix below mirrors the current Typer command signatures in src/nbadb/cli/commands.
Pipeline commands
| Command | What it does | Positional args | Options |
|---|---|---|---|
nbadb init | Full rebuild across historical seasons | — | --data-dir/-d, --format/-f (repeatable), --season-start/-s (default: 1946), --season-end/-e, --verbose/-v, --quality-check |
nbadb daily | Current-season refresh focused on recent games | — | --data-dir/-d, --verbose/-v, --quality-check |
nbadb monthly | Refresh the last 3 seasons | — | --data-dir/-d, --verbose/-v, --quality-check |
nbadb full | Retry failed extractions and fill historical gaps | — | --data-dir/-d, --verbose/-v, --quality-check |
Inspection and quality commands
| Command | What it does | Positional args | Options |
|---|---|---|---|
nbadb schema [TABLE] | List all discovered output tables or show lineage for one table | optional TABLE | — |
nbadb status | Show pipeline status, watermarks, and metadata | — | --data-dir/-d, --output-format/-f (default: text; json supported) |
nbadb run-quality | Run quality checks against the existing DuckDB database | — | --data-dir/-d, --report-path |
nbadb ask QUESTION | Ask the local query agent a natural-language question | required QUESTION | --limit/-l (default: 10), --verbose/-v |
Distribution and artifact commands
| Command | What it does | Positional args | Options |
|---|---|---|---|
nbadb export | Re-export user tables from DuckDB into configured output formats | — | --data-dir/-d, --format/-f (repeatable) |
nbadb download | Download the latest Kaggle dataset into the data directory | — | --data-dir/-d |
nbadb upload | Upload the dataset directory to Kaggle | — | --data-dir/-d, --message/-m (default: "Automated update") |
nbadb migrate | Create or migrate pipeline tables | — | --data-dir/-d |
nbadb docs-autogen | Regenerate generated docs artifacts under the docs content tree | — | --docs-root (default: docs/content/docs) |
nbadb extract-completeness | Generate endpoint coverage artifacts | — | --output-dir/-o, --require-full, --require-model-contract |
Related guides
- Installation for setup and environment defaults
- Architecture for run-mode context and warehouse boundaries
- Daily Updates for recurring refreshes
- Kaggle Setup for download/upload workflows
- Troubleshooting Playbook for CI, docs, and artifact failures
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.