nbadbArena Data Lab
Schema ReferenceHalf-Court MapSchema12 waypoints

Court Geometry

Schema Reference

Scouting dossier for the nbadb warehouse model and schema-backed reference tiers

Schema Reference

The nbadb analytical surface currently exposes 141 public tables/views across dimensions, facts, bridges, derived aggregations, and analytics views.

Treat this section like the warehouse playbook: the curated pages explain how the lineup fits together, while the generated reference pages give you the box-score-exact schema contracts when you need to check a column, key, or constraint at 2am.

Public surface
141
tables + views on the analytical floor
Dimensions
17
identity, history, and lookup spacing
Facts + bridges
104
102 fact outputs plus 2 bridge connectors
Shortcuts
20
16 agg_ tables plus 4 analytics_ views

The curated pages explain how to use the model. The raw, staging, and star reference pages are generated, schema-backed artifacts: use them for exact contracts, and regenerate them instead of hand-editing when the code changes.

How to work this section

  1. Pick the right family first. Use the curated pages to decide whether the question belongs in dimensions, facts, agg_ rollups, or analytics_ shortcuts.
  2. Lock the join lane second. Use Relationships once you know the tables but need the safest path between them.
  3. Confirm exact contracts last. Finish on the generated Raw Reference, Staging Reference, or Star Reference when the question becomes "what are the exact columns and constraints?"

Quick navigation

Start here

Find the right table family

Use Dimensions, Facts & Bridges, Derived Aggregations, and Analytics Views when you are still deciding which surface actually answers the question.

Start here

Plan the join lane

Jump to Relationships when you already know the tables involved but need the clean join path, common keys, or naming traps before you write SQL.

Exact columns

Check the generated contract

Go straight to Raw Reference, Staging Reference, or Star Reference when the question is about exact fields, nullability, or schema-backed constraints.

Workflow

Move from concept to query

Start on the curated page for judgment, then switch to the generated tier page for exactness once the table family and join lane are locked in.

Tipoff route

Choose by working state

If you are currently...Best first pageWhy
deciding which table family probably owns the answerDimensions, Facts & Bridges, Derived Aggregations, or Analytics ViewsThe curated family pages optimize for judgment, not exhaustive column detail
holding a known table but unsure how to join it safelyRelationshipsIt maps the clean join lanes and common naming traps
verifying exact field names, types, or nullabilityStar ReferenceThe generated star page is the contract surface for public analytical objects
tracing where a field looked the way it did before transformationRaw Reference or Staging ReferenceThose pages preserve the upstream and normalized tiers feeding the warehouse
trying to move from a notebook question to a stable reusable queryStart on the curated family page, then end on the generated tier pageThat sequence keeps discovery and exactness separate instead of forcing one page to do both

Choose by question

If you need to answer...Start hereWhy this page is the right first pass
Who is this row about, and what entity context exists?DimensionsThe dimension lineup card explains identity, calendar, venue, and vocabulary tables
Where do the measures actually live?Facts & BridgesThe fact scouting report groups the 102 fact outputs by grain and job
How should I join these surfaces without duplicating rows?RelationshipsThe join playbook shows common lanes across player, team, game, and event analysis
Is there already a rollup for this question?Derived AggregationsThe second-unit tables precompute recurring player, team, and league summaries
Can I skip manual joins for a common workflow?Analytics ViewsThe analytics views are the fast-break outlets for notebooks and dashboards
What is the exact generated contract for a schema-backed tier?Raw Reference, Staging Reference, or Star ReferenceThese dense pages are the source-of-truth reference sheets for generated schema docs

Entry routes by starting handle

Entry surface

I have a player or team question

Start with Facts & Bridges if the question is about stats, or Dimensions if you need identity, franchise, or roster context first.

Entry surface

I have a game_id

Start with Facts & Bridges for player-game, team-game, play-by-play, shot, or rotation grain. Then use Relationships to add both teams and supporting dimensions cleanly.

Entry surface

I have a season-level reporting ask

Start with Derived Aggregations for reusable rollups, then fall back to Facts & Bridges only when the needed split or metric does not already exist.

Entry surface

I just need the exact schema

Skip the curated guide layer and go straight to the generated Star Reference or the upstream Raw / Staging references.

Public categories

CategoryCountPrefixWhat it covers
Dimensions17dim_Conformed context such as players, teams, games, seasons, dates, arenas, and lookup vocabularies
Facts102fact_Event-, game-, season-, dashboard-, and specialty-grain measurements for analysis
Bridges2bridge_Many-to-many connectors used to fan out officials and play participants cleanly
Derived Aggregations16agg_Pre-aggregated rollups for repeat player, team, lineup, and league questions
Analytics Views4analytics_Pre-joined analyst-friendly surfaces for first-pass reads
Tier reference lanes

Curated vs generated boundaries

Page typeWhat it is optimized forWhat it is not trying to be
Curated schema guidesTable-family choice, join judgment, workflow advice, and "where should I start?" questionsExhaustive field-by-field contracts
Generated tier referencesExact columns, types, nullability, and schema-backed constraintsNarrative explanation of how an analyst should use the model
Relationships pageJoin patterns, key lanes, and duplicate-row avoidanceFull generated ER output or field dictionary detail

Generated tier references

Use these pages when the question is not conceptual but contractual.

TierPageWhat it representsBest for
Inbound feed contractsRaw ReferenceEndpoint-shaped schemas closest to nba_api result setsTracing source naming, original payload fidelity, and extraction expectations
Warehouse-ready normalizationStaging ReferenceCleaned, typed staging schemas after normalization and key alignmentUnderstanding load-time cleanup and the shape feeding transforms
Public schema-backed surfaceStar ReferenceGenerated final-tier schemas for dimensions, facts, bridges, and selected public outputsVerifying exact public columns, nullability, and constraints
Join strategyRelationshipsCurated join patterns across the star surfacePlanning how those tiers come back together in SQL

Regenerate the command-owned reference pages with:

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

Warehouse offensive system

  • Star first: dimensions create stable context around fact grains so common queries stay join-friendly.
  • History where it matters: dim_player and dim_team_history use SCD Type 2 semantics for time-aware identity tracking.
  • Conformed anchors: player_id, team_id, game_id, and season_year do most of the passing across the model.
  • Smallest useful grain: start at the narrowest fact that answers the question, then climb to agg_ or analytics_ only when the use case repeats.
  • Generated pages for exactness, curated pages for judgment: use both together rather than expecting one page to do every job.

Prefix quick read

If the object starts with...Read it as...Usually start on...
dim_conformed context and identityDimensions
fact_measurable events or summaries at a defined grainFacts & Bridges
bridge_many-to-many connectorFacts & Bridges or Relationships
agg_reusable pre-aggregated rollupDerived Aggregations
analytics_pre-joined convenience surfaceAnalytics Views
stg_ / raw_upstream non-public reference tiersStaging Reference or Raw Reference

Naming conventions

PrefixMeaningExample
dim_Dimension tabledim_player
fact_Fact tablefact_player_game_traditional
bridge_Bridge tablebridge_game_official
agg_Aggregate tableagg_player_career
analytics_Analytics view/tableanalytics_player_game_complete
stg_Staging tablestg_league_game_finder__by_team
raw_Raw schema/reference objectraw_boxscoretraditionalv3

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