weavori generate
Connect to a PostgreSQL database and generate a referentially intact synthetic replica.
Last updated August 14, 2026
Usage
The generate command introspects your source database, resolves foreign key dependencies, samples column distributions, and generates synthetic data into a target database.
Two modes are available:
- Standard mode: connects to a live source database, introspects its schema
- Paste mode (
--input-format ddl): parses CREATE TABLE statements without a live database
Flags
| Flag | Default | Description |
|---|---|---|
--rows | 1000 | Number of rows to generate per table |
--target | "" | Target database DSN |
--url | "" | Alias for --target |
--fast | false | Prioritize generation speed over distribution accuracy using an optimized sampling strategy |
--sample-rows | 0 | Draw a fixed-size sample of source rows to balance generation speed and distribution accuracy |
--no-sampling | false | Skip source data analysis and generate purely random values |
--create-tables | true | Create schemas and tables on the output before writing data |
--yes | false | Skip interactive preview and use defaults (CI mode) |
--input-format | "" | Input format: ddl (requires --input or --stdin) |
--input | "" | Input file for paste mode |
--stdin | false | Read input from stdin (requires --input-format) |
--format | "json" | Data output format: json or csv (paste mode without --target) |
--formula | Computed column formula (repeatable: --formula 'col=expr') | |
--dataset | Register a CSV dataset (repeatable: --dataset name=path.csv) | |
--map | Map a column to a dataset (repeatable: --map table.col=dataset.col) | |
--seed | 0 | Reproduce a run: the same seed generates byte-identical rows. 0 is random; the seed is printed at run start so any run can be replayed with --seed <n> |
--distribution | Shape a column's values (repeatable: --distribution 'orders.status=zipf' or --distribution 'users.age=normal:mean=35,stddev=10'). Keys use the table.column form; a bare uniform sets the global default. Models: uniform, zipf, normal, lognormal, weighted | |
--null-rate | Set a nullable column's null probability (repeatable: --null-rate 'users.middle_name=0.3'). Keys use table.column; a bare value sets the global default for nullable columns | |
--since | "" | Lower bound for every generated timestamp (RFC 3339 or YYYY-MM-DD) |
--until | "" | Upper bound for every generated timestamp (RFC 3339 or YYYY-MM-DD, inclusive) |
--no-cache | false | Bypass schema cache and force re-introspection |
Persistent flags
These flags are inherited from the root command and available on generate:
| Flag | Default | Description |
|---|---|---|
--api-key | "" | API key for non-interactive authentication |
--output | "pretty" | Output format: pretty, plain, or json |
-v, --verbose | false | Enable debug output |
Environment variables
| Variable | Description |
|---|---|
WEAVORI_DATABASE_URL | Source database DSN used when no positional argument is given |
WEAVORI_API_KEY | API key for non-interactive auth (alternative to --api-key) |
WEAVORI_OUTPUT | Output format (alternative to --output): pretty, plain, or json |
Examples
Plan only (no output)
Full generation
Fast mode (1% sampling)
CI mode (non-interactive)
Bypass schema cache
DDL paste mode
Generate synthetic data from DDL definitions without a live source database:
Or pipe DDL from stdin:
Output goes to stdout as JSON (default) or CSV (use --format csv). Specify --target to write to a database instead.
Formulas
Define computed columns using repeatable --formula flags:
Custom datasets
Use CSV files as lookup sources for column generation:
Reproducible runs
Pass --seed to make a run repeatable. The same seed generates byte-identical rows, which is what you want for fixtures, snapshot tests, and CI.
Weavori prints the seed at the start of every run. With no --seed it draws a random one and still tells you what it was, so any run can be replayed later with --seed <n>.
Value distributions and null rates
Shape individual columns with --distribution and --null-rate. Keys use the table.column form; a bare uniform (for --distribution) or a bare number (for --null-rate) sets the global default. These flags also read from weavori.yaml.
Available distribution models: uniform, zipf, normal, lognormal, and weighted. Numeric models (normal, lognormal) apply to numeric columns; zipf concentrates over a ranked discrete set.
Time-bounded generation
Clamp every generated timestamp into a window with --since and --until (RFC 3339 or YYYY-MM-DD):
Trigger detection
Weavori automatically detects ON INSERT triggers during introspection and accounts for them in the generation plan. Columns populated by triggers are skipped during generation, and the generation order respects trigger dependencies.