Quickstart

Generate your first realistic, repeatable test dataset from a schema in a few minutes.

This walkthrough uses a schema file, so it works without a running database.

1. Point Ghostrow at a schema

ghostrow seed --schema schema.sql --dry-run

--dry-run reads the schema and shows what Ghostrow inferred, without writing any rows:

An excerpt of the real output for a six-table shop schema:

read schema   6 tables, 5 foreign keys (shop.sql, Free)
understood    customers.email                  email  (0.83, name, type)
              customers.nic                    Sri Lankan NIC  (0.96, name, type, CHECK on length 10 or 12)
              orders.total                     sum of order_lines.amount  (0.99, name, type)
              order_lines.amount               quantity × unit_price  (0.99, name, type)
rules         order_lines: amount = quantity × unit_price  (column names quantity, unit_price and amount)
              orders: orders.total = sum of order_lines.amount  (order_lines references orders and both carry an amount)
rows          tenants 19, customers 56, products 167, orders 167, order_lines 500, subscriptions 500 (with the current --rows)
rules         saved to ghostrow.rules.yaml

Each line shows the meaning, a confidence between 0 and 1, and the evidence it came from.

2. Review the rules

Open ghostrow.rules.yaml. Each inferred rule is listed with the evidence Ghostrow used. Edit anything that is wrong, then commit the file with your code so everyone generates the same data.

3. Generate

ghostrow seed --schema schema.sql --rows 5000 --seed 42 --out fixtures/

This writes one CSV per table to fixtures/. Use --format sql or --format json for other formats, or --db $DATABASE_URL to insert straight into a database.

4. Make it repeatable in CI

The same schema, rules file and --seed value always give the same rows. Add the command to your test setup, and your tests see identical data on every run.

Next

  • Try ghostrow haunt to generate edge cases (Pro and Max).
  • Read the CLI reference.