Skip to content

Sales analytics facts and dimensions

Sales facts joined to date and region dimensions.

related volume small AnalyticsSalesRelationships
Languages
eng
Formats
csv

Recipe

recipe.gbddl
gbddl 1
language eng

table dates rows 12 (
  id  int64 autoincrement primarykey
  day date date(min: "2023-01-01", max: "2024-12-31")
)

table regions rows 4 (
  id   int64 autoincrement primarykey
  name text enum(values: ["north", "south", "east", "west"])
)

table sales_facts rows 40 per(dates, 1, 4) (
  id        int64 autoincrement primarykey
  date_id   int64 fk(dates.id)
  region_id int64 fk(regions.id)
  units     int64 integer(min: 1, max: 500)
  revenue   decimal(12, 2) decimal(min: 1, max: 100000)
  suffix    text domainSuffix()
)

output csv

This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.

About this recipe

Sales analytics

A multi-table recipe that generates a sales analytics star: facts joined to date and region dimensions.

What it demonstrates

  • Relationships — sales_facts references dates and regions.
  • Dimensions and facts — dates and regions are the dimensions; sales_facts holds units, revenue and a suffix domain.
  • Row distribution — per(dates, 1, 4) groups facts per date.

Run it

Submit the recipe body to POST /api/v1/jobs?input_format=gbddl, or paste it into Chef, to generate the data. The repository's local runner (run by task test) also generates it and verifies its output.

The recipe outputs CSV files: dates.csv, regions.csv and sales_facts.csv.

Guarantees

Every foreign key names an existing parent row and per(...) grouping holds. Values are synthetic.

Tested features

Smart types, physical types, rules and formats this recipe exercises and verifies.

dateenumintegerdecimaldomainSuffixfkperautoincrementprimary-key