Realistic test data, generated from a schema you already have.
Rust · MIT · CSV, JSONL, Parquet
Staging usually runs on a stale export with a few hundred rows. So nothing that breaks in production breaks in staging. Query plans are wrong, joins look fast for the wrong reason, and nobody finds out until a customer does.
gen-d reads your schema, in Excel or JSON, and fills those tables at whatever scale you actually run at. Foreign keys stay valid. Parents come before children.
gen-d --schema examples/simple.schema.json --output ./out --format parquetgit clone https://github.com/aathif394/gen-d
cd gen-d
cargo build --release
./target/release/gen-d --helpUse --release. The debug build is about 30x slower.
Column names decide the data. A column called EMAIL gets an email. CITY gets
a city. ORDER_TOTAL gets money. There is nothing to annotate unless you want to
override something.
Foreign keys are declared once:
{ "name": "CUSTOMER_ID", "fk": "Customers.CUSTOMER_ID" }Children then draw from keys that actually exist in the parent, and parents are
generated first. Self-references work too, so a MANAGER_ID pointing back at
Employees.EMPLOYEE_ID builds a real reporting tree.
- Excel or JSON schemas, one sheet or one object per table
- Valid foreign keys, including self-references, resolved in dependency order
- Parallel generation across every core, streamed to disk rather than held in memory
--pool-capbounds how many parent keys stay resident, so a 100M-row parent does not become a 100M-entry map--rows-per-filesplits a large table into numbered parts- CSV, JSONL and Parquet output
--value-configto control the actual values: choice lists, composite templates, column rules- PII columns can be tokenised instead of faked, so a masked export keeps its shape without inventing plausible personal details
- Ten presets for when you have no schema and just need a table:
people,products,sales,companies,transactions,support-tickets,reviews,events,employees,vehicles
Two schemas ship with the repo.
examples/simple.schema.json — customers and
orders, one foreign key. Start here.
gen-d --schema examples/simple.schema.json --output ./outexamples/retail.schema.json — eleven tables,
fourteen foreign keys, two self-references, around 11M rows at the counts as
written.
Regions ──┬── Suppliers ──┐
├── Warehouses ─┼── Products ── Inventory
└── Customers │ │
│ └── Order_Items
Categories ── Categories │ │
(self) │ │
Employees ── Employees └── Orders ───┘
(self) │ │
│ └── Payments
└── Support_Tickets
# the whole thing
gen-d --schema examples/retail.schema.json --format parquet --output ./out
# smaller, for a laptop
gen-d --schema examples/retail.schema.json \
--table-rows Orders=50000 \
--table-rows Order_Items=150000 \
--table-rows Payments=50000 \
--output ./outPreset, no schema:
gen-d --preset people --rows 1000000 --format csv --output ./outExcel schema, skipping sheets that are documentation:
gen-d --schema schema.xlsx \
--skip-sheet Dashboard \
--skip-sheet Notes \
--output ./outLarge table, split into 5M-row files, memory held flat:
gen-d --schema examples/retail.schema.json \
--rows-per-file 5000000 \
--pool-cap 2000000 \
--format parquet \
--output ./outYour own value pools:
gen-d --schema examples/retail.schema.json \
--value-config examples/values.example.json \
--output ./outOne-off table with no schema file:
gen-d --config examples/columns.example.yaml --rows 250000 --output ./out| Flag | What it does |
|---|---|
--schema <PATH> |
Excel or JSON schema |
--config <PATH> |
YAML column list, for a single ad-hoc table |
--preset <NAME> |
Built-in table shape instead of a schema |
--rows <N> |
Rows, for preset and config modes |
--columns <N> |
Column count, for preset mode |
--table-rows <TABLE=ROWS> |
Override rows for one table. Repeatable |
--skip-sheet <SHEET> |
Ignore an Excel sheet. Repeatable |
--value-config <PATH> |
JSON file of choice lists and column rules |
--pool-cap <ROWS> |
Max parent keys held per FK column. Default 10,000,000 |
--rows-per-file <N> |
Split each table into parts of at most N rows |
--format <FMT> |
csv, jsonl or parquet |
--output <DIR> |
Where to write |
{
"tables": [
{
"name": "Customers",
"rows": 5000,
"columns": [
{ "name": "CUSTOMER_ID" },
{ "name": "CUSTOMER_NAME" },
{ "name": "EMAIL" }
]
},
{
"name": "Orders",
"rows": 50000,
"columns": [
{ "name": "ORDER_ID" },
{ "name": "CUSTOMER_ID", "fk": "Customers.CUSTOMER_ID" },
{ "name": "ORDER_TOTAL" }
]
}
]
}rows is optional and --table-rows overrides it. fk is Table.COLUMN and
must name a table in the same schema.
One sheet per table, sheet name becomes the table name, first row is column
names. Write a header cell as Parent.COLUMN to mark a foreign key. Sheets that
are documentation can be dropped with --skip-sheet.
For a single table with no schema file:
columns:
- name: user_id
data_type: uuid
- name: full_name
data_type: name
- name: email
data_type: email
- name: signed_up
data_type: date
- name: mrr
data_type: amountEverything here is optional. Leave a section out and the built-in defaults apply.
{
"choices": {
"order_status": ["Placed", "Paid", "Shipped", "Delivered", "Returned"],
"segment": ["New", "Returning", "Loyal", "Dormant"]
},
"columns": {
"ORDER_STATUS": { "choices_key": "order_status" },
"SEGMENT": { "choices_key": "segment" }
},
"composite_templates": {
"street_address": {
"parts": ["${building_number}", " ", "${street_name}", " ", "${street_suffix}"]
}
},
"pattern_rules": [
{ "contains": "EMAIL", "data_type": "email" },
{ "contains": "TOTAL", "data_type": "amount" },
{ "ends_with": "_AT", "data_type": "date" }
],
"pii_column_types": { "FIRST_NAME": "fname_token" },
"pii_masking": { "fname_token": "FNAME_{index:06}" }
}| Key | What it controls |
|---|---|
choices |
Named lists to sample from. Repeat a value to weight it |
columns |
Binds a column name to a choices_key |
composite_templates |
Builds one value out of several generated parts |
pattern_rules |
Maps column names to data types by equals, contains or ends_with |
pii_column_types |
Marks a column as tokenised rather than faked |
pii_masking |
Token format for each PII type |
Working example: examples/values.example.json
For the YAML config and for pattern_rules:
uuid integer number amount age year
name first_name last_name username email phone
company domain url ipv4 mac_address
date date_birth boolean word sentence paragraph
ssn zip building_number
You rarely set these by hand. pattern_rules matches on column name first, so
ORDER_TOTAL becomes an amount without any configuration.
The output directory and every generated .csv, .parquet and .jsonl is
gitignored. Do not commit generated data.
Everything it produces is fake. Values are plausible and internally consistent, but no real record goes in and none comes out.
Row counts in retail.schema.json are deliberately production-sized. Override
them with --table-rows before running it on a laptop.
MIT. See LICENSE.