Skip to main content

Netstar Source (BigQuery)

Netstar is Mercedes-Benz's internal system of record. The ai_mb project reads from BigQuery tables that mirror Netstar data.

Required Environment Variables

VariableDefaultPurpose
MERCEDES_GCP_PROJECTai-app-mercedesGCP project containing the Netstar dataset
GCP_CREDENTIALSService account JSON key content (production only; omit to use ADC locally)

The project has a sensible default for production. The BigQuery dataset is fixed as netstar.

Authentication

In local development, authenticate with Application Default Credentials (ADC):

gcloud auth application-default login

In production, set GCP_CREDENTIALS to the JSON content of a service account key (not a file path). The BigQueryResource registered in definitions.py reads this env var via gcp_credentials=dg.EnvVar("GCP_CREDENTIALS").

Dagster Resource Key

The BigQuery client is injected via the standard BIG_QUERY_RESOURCE_KEY resource (value: "big_query_resource") exported from ai_core.components.raw_historical. All Netstar raw components extend NetstarBQRawSourceComponent, which declares this key in _required_resource_keys() and provides a _bq_dataset(bq) helper that builds the fully-qualified dataset string from the resource's project (the dataset is fixed as netstar).

Tables

ResourceTableNotes
Modelsnetstar.model-detailsModel variants; baumuster is the manufacturer code
Featuresnetstar.accessoriesOption/package catalog keyed by baumuster + modelYear
Inventorynetstar.inventory_*Wildcard over per-day sub-tables; deduped to latest revision per id using _PARTITIONTIME
Salesnetstar.sales_*Retailed vehicles; used for sold-date signals and rolling metrics

The features fetch depends on models — it uses the baumuster → model_code map built from the models response to resolve accessory rows to a canonical model_code. This upstream dependency is expressed via upstream_dep in the raw component YAML.

Sentinel prices

Netstar emits placeholder prices ≥ 1,000,000 (e.g. 7,777,777) on some rows. These are nulled out during extraction so they don't interfere with real price values at the consolidated tier.

Option ID normalization

Netstar accessory IDs use underscore separators ("0_413"). The extractor normalizes these to colon form ("0:413") to match the NAFTA BYO convention, so the same option resolves to the same option_id regardless of source.