weavori generate
Connect to a PostgreSQL database and generate a referentially intact synthetic replica.
Last updated October 20, 2018
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) | |
--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:
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.