Composed sales with customers, orders, items and payments
A related, multi-table sales dataset spanning customers, products, orders, order items and payments.
- Languages
eng- Formats
json
Recipe
gbddl 1
language eng
table customers rows 8 (
id int64 autoincrement primarykey
name text same(person) fullName()
email text same(person) email()
)
table products rows 10 (
id int64 autoincrement primarykey
name text words(maxWords: 3)
price decimal(8, 2) decimal(min: 1, max: 500)
)
table orders rows 20 per(customers, 1, 3) (
id int64 autoincrement primarykey
customer_id int64 fk(customers.id)
ordered_at timestamp datetime(min: "2023-01-01 00:00:00", max: "2024-12-31 23:59:59")
status text enum(values: ["draft","confirmed","shipped","delivered","cancelled"])
)
table order_items rows 60 per(orders, 1, 4) (
id int64 autoincrement primarykey
order_id int64 fk(orders.id)
product_id int64 fk(products.id)
quantity int64 integer(min: 1, max: 5)
unit_price decimal(8, 2) eq(product_id.price)
line_total decimal(10, 2) decimal(min: 1, max: 5000)
)
table payments rows 15 per(orders, 0, 1) (
id int64 autoincrement primarykey
order_id int64 fk(orders.id)
amount decimal(10, 2) decimal(min: 1, max: 2000)
paid_at timestamp datetime(min: "2023-01-01 00:00:00", max: "2024-12-31 23:59:59")
method text enum(values: ["card","bank_transfer","cash"])
)
output json (pretty: true, maxRowsPerFile: 50)
This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.
About this recipe
Sales
A multi-table recipe that generates a small sales dataset: customers, products,
orders, order items and payments, related by foreign keys and grouped by per.
What it demonstrates
- Composition — five tables span the order lifecycle.
- Relationships —
ordersreferencescustomers,order_itemsreferencesordersandproducts, andpaymentsreferencesorders. - Row distribution —
per(...)groups child rows by parent: each customer has 1 to 3 orders, each order 1 to 4 items, and each order 0 or 1 payments. - Cross-table values —
order_items.unit_pricecopies the referenced product'spricewitheq(product_id.price).
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 flat JSON with one file per table: customers.json,
products.json, orders.json, order_items.json and payments.json.
Adapt it
- Add a
rootprojection to nest items inside orders as a single document. - Raise the table row counts for a larger dataset.
Guarantees
Every primary key is unique, every foreign key names an existing parent row,
per(...) grouping holds for every child table, and unit_price always equals
its product's price. The numbers are synthetic and not balanced like a real
ledger.
Tested features
Smart types, physical types, rules and formats this recipe exercises and verifies.
fullNameemailwordsdecimaldatetimeenumintegereqfkpersame:personautoincrementprimary-keyjson.maxRowsPerFile