E-commerce returns
Orders, items and their returns with reasons.
related
volume small
E-commerceOrdersRelationships
- Languages
eng- Formats
csv
Recipe
gbddl 1
language eng
table orders rows 10 (
id int64 autoincrement primarykey
ordered_on date date(min: "2023-01-01", max: "2024-12-31")
)
table order_items rows 25 per(orders, 1, 4) (
id int64 autoincrement primarykey
order_id int64 fk(orders.id)
name text enum(values: ["Wireless earbuds", "Running shoes", "Coffee grinder", "Yoga mat", "Desk lamp", "Backpack", "Phone case", "Water bottle", "Bluetooth speaker", "Cotton T-shirt"])
quantity int64 integer(min: 1, max: 5)
)
table returns rows 12 per(orders, 0, 2) (
id int64 autoincrement primarykey
order_id int64 fk(orders.id)
reason text enum(values: ["damaged", "wrong_item", "not_needed", "late"])
requested_on date date(min: "2023-01-01", max: "2024-12-31")
)
output csv
This is the exact recipe.gbddl committed to the repository. Copy it, or download the raw source.
About this recipe
E-commerce returns
A multi-table recipe that generates e-commerce returns: orders, items and their returns.
What it demonstrates
- Relationships —
order_itemsandreturnsreferenceorders. - Row distribution —
per(orders, ...)groups items (1 to 4) and returns (0 to 2) per order, so some orders have no return. - Return reason —
reasonpicks from anenum.
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: orders.csv, order_items.csv and
returns.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.
dateintegerenumfkperautoincrementprimary-key