Uniqueness, distinct values and finite capacity
Unique keys, a finite distinct column, and a composite foreign-key primary key.
- Languages
eng- Formats
csv
Recipe
gbddl 1
language eng
table tags rows 15 (
id int64 autoincrement primarykey
name text unique words(maxWords: 2)
color text distinct(5) color()
)
table items rows 20 (
id int64 autoincrement primarykey
code text unique pattern(pattern: "ITEM-#####")
region text enum(values: ["north", "south", "east", "west"])
local int64 integer(min: 1, max: 1000)
)
table item_tags rows 30 (
item_id int64 fk(items.id)
tag_id int64 fk(tags.id)
primarykey(item_id, tag_id)
)
output csv
This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.
About this recipe
Uniqueness and capacity
A multi-table recipe that demonstrates uniqueness, distinct values and finite capacity across keys.
What it demonstrates
- Unique keys —
tags.nameanditems.codeareunique. - Distinct values —
tags.colorusesdistinct(5), so only five colors repeat across the rows. - Composite key —
item_tagshas a composite primary key over the two foreign-key columns, so each item/tag pair is unique.
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: tags.csv, items.csv and item_tags.csv.
Guarantees
tags.name, items.code and the item_tags composite key are all unique;
tags.color has exactly five distinct values. Foreign keys name existing
parent rows. Values are synthetic.
Tested features
Smart types, physical types, rules and formats this recipe exercises and verifies.
wordscolordistinctpatternenumintegeruniquefkautoincrementprimary-key