General ledger with bounded journal amounts
Accounts and journal entries where an integer amount is bounded between two columns.
- Languages
eng- Formats
csv
Recipe
gbddl 1
language eng
table accounts rows 8 (
id int64 autoincrement primarykey
number text unique pattern(pattern: "####")
name text words(maxWords: 3)
)
table journal_entries rows 30 per(accounts, 1, 5) (
id int64 autoincrement primarykey
account_id int64 fk(accounts.id)
lower int64 integer(min: 0, max: 40000)
upper int64 integer(min: 60000, max: 100000)
amount int64 gt(lower) lt(upper) integer(min: 0, max: 100000)
side text enum(values: ["S", "H"])
period text regexp(pattern: "0(0[1-9]|1[0-6])")
posted_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
General ledger
A multi-table recipe that generates a general ledger: accounts and journal entries where each integer amount is bounded between two of its own columns.
What it demonstrates
- Local comparison —
amountisgt(lower)andlt(upper), comparisons against sibling columns of the same row. - Relationships —
journal_entriesreferencesaccounts. - Row distribution —
per(accounts, 1, 5)gives each account one to five entries. - Debit and credit —
sideis anenumofS(Soll, debit) andH(Haben, credit), as SAP and DATEV write it; use["D", "C"]or["+", "-"]for other systems. - Fiscal period —
periodis aregexpfor the SAP posting periods001to012plus the special periods013to016.
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: accounts.csv and journal_entries.csv.
Guarantees
Every amount is strictly between its row's lower and upper, every foreign
key names an existing parent row, and per(...) grouping holds. Values are
synthetic and not a balanced ledger.
Tested features
Smart types, physical types, rules and formats this recipe exercises and verifies.
patternwordsintegerdatecomparison-localenumregexpuniquefkperautoincrementprimary-key