Product batches and expiry
Products with tracked batches, expiry dates and quantities.
related
volume small
InventoryProductsRelationships
- Languages
eng- Formats
csv
Recipe
gbddl 1
language eng
table products rows 8 (
id int64 autoincrement primarykey
name text words(maxWords: 3)
)
table batches rows 20 per(products, 1, 4) (
id int64 autoincrement primarykey
product_id int64 fk(products.id)
batch_number text unique pattern(pattern: "B-#####")
expiry date date(min: "2024-01-01", max: "2026-12-31")
quantity int64 integer(min: 0, max: 1000)
)
output csv
This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.
About this recipe
Product batches
A multi-table recipe that generates product batches: products with tracked batches, expiry dates and quantities.
What it demonstrates
- Relationships —
batchesreferencesproducts. - Row distribution —
per(products, 1, 4)gives each product one to four batches. - Batch identity —
batch_numberis auniquepatternmask, with anexpirydate and aquantity.
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: products.csv and batches.csv.
Guarantees
Every primary key is unique, 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.
wordspatterndateintegeruniquefkperautoincrementprimary-key