Skip to content

Hotel reservations

Guests, rooms and their bookings.

related volume small HospitalityRelationships
Languages
eng
Formats
csv

Recipe

recipe.gbddl
gbddl 1
language eng

table guests rows 10 (
  id    int64 autoincrement primarykey
  name  text same(person) fullName()
  email text same(person) email()
)

table rooms rows 8 (
  id     int64 autoincrement primarykey
  number text unique pattern(pattern: "R-###")
  kind   text enum(values: ["single", "double", "suite"])
)

table bookings rows 20 per(guests, 1, 3) (
  id        int64 autoincrement primarykey
  guest_id  int64 fk(guests.id)
  room_id   int64 fk(rooms.id)
  check_in  date date(min: "2023-01-01", max: "2024-12-31")
  check_out date date(min: "2023-01-02", max: "2025-01-31")
  status    text enum(values: ["confirmed", "checked_in", "checked_out", "cancelled"])
)

output csv

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

About this recipe

Hotel reservations

A multi-table recipe that generates hotel reservations: guests, rooms and their bookings.

What it demonstrates

  • Relationships — bookings references guests and rooms.
  • Room identity — number is a unique pattern mask and kind an enum.
  • Booking dates — check_in and check_out are dates with a status.

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: guests.csv, rooms.csv and bookings.csv.

Guarantees

Every foreign key names an existing parent row, per(...) grouping holds, and rooms.number is unique. Values are synthetic.

Tested features

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

fullNameemailpatternenumdateuniquefkpersame:personautoincrementprimary-key