PostgreSQL data generator: realistic rows from your schema

A Postgres data generator fills a database with rows you can test against. Most ask you to describe every column by hand — which is why teams search for a fake or dummy data generator and still end up maintaining scripts. Weavori reads your schema instead, and generates referentially intact, distribution-true rows in one command. No YAML, no DSL.

A PostgreSQL data generator fills a Postgres database with rows you can test against — for local development, staging, CI, or load testing. The category splits in two: generators where you describe every column by hand, and schema-driven generators that read your tables and foreign keys and produce rows that fit. This guide covers what a data generator does, where the hand-built ones break, and how to generate referentially intact Postgres data in one command.

What is a PostgreSQL data generator?

A PostgreSQL data generator creates rows for a Postgres database. It comes in two kinds, and the difference decides how much work lands on you:

Generator typeInputFK handlingSetup
Field-by-field (Mockaroo, Faker loops)Your column definitionsManualPer-column
Schema-driven (Weavori)Your schemaBy constructionOne command

A field-by-field generator asks you to describe the data: pick a column, pick a type, map the relationships yourself. A schema-driven generator asks the schema — it introspects tables, foreign keys, types, and constraints, then generates rows that fit. The first is fast for a flat CSV. The second is the only one that scales to a relational schema.

"Dummy data" vs "fake data" vs synthetic data

Three phrases circle the same job, but they point at different tools. "Dummy data generator" and "fake data generator" are the most common ways people search; "synthetic data" is what the schema-aware tools call the output.

  • Fake / dummy data — plausible-looking values generated in isolation: a name, an email, a random number. Fine for a demo; ignores your schema.
  • Synthetic data — fresh rows generated from your schema: foreign keys reference real parents, and column values follow your production distributions.
  • Anonymized data — real rows with sensitive fields transformed. A different job entirely: de-identifying existing data, not creating new data.

Weavori generates synthetic data. If you arrived searching for a dummy or fake data generator, the schema-driven approach is the upgrade — same one command, but the output survives a skeptical look.

Where hand-built generators break

Field-by-field generators and custom scripts fail in three ways, in order of appearance:

  1. Foreign keys. Creating an order requires a user id that does not exist yet. You either insert the parent first and capture the id (the script now encodes dependency order by hand), or look it up — and when the lookup is wrong, the generator silently produces data that does not match your intent.
  2. Schema drift. Add a NOT NULL column or a relation and the script stops matching the schema. Every schema change becomes a generator change, and the generator is the last file anyone updates.
  3. Uniform randomness. A flat random loop is not a distribution. If 70% of your real status values are active, a uniform generator gives you roughly a third of each — and the Postgres query planner responds with different indexes, joins, and plans than production.

How Weavori generates Postgres data

Weavori reads the schema as the source of truth. The workflow is three steps:

  1. Connect — point Weavori at any PostgreSQL database, or paste CREATE TABLE statements (DDL paste mode) when no database exists yet
  2. Introspect — it reads tables, foreign keys, column types, constraints, and value distributions (pg_stats)
  3. Generate — parents generate before children in FK dependency order, streaming rows with constant memory
$npx --yes @weavori/cli generate postgres://localhost:5432/mydb

The preview shows the full plan before a single row is written — estimated rows per table, generator choices, and any columns it will fall back on. Approve it and Weavori writes directly to the target database via COPY, or to stdout as JSON/CSV.

i

Speed is not a trade-off

Benchmarks measured July 2026 against Weavori's internal suite (pgbench-derived schema, Dockerized PostgreSQL 17, generation into a target database via COPY): 100,000 rows across 14 tables in 12.4 seconds, 25,000 rows in 2.1 seconds, 2,500 rows in 384 ms. Typical schemas — under 200 tables — complete in under 2 minutes. Numbers vary with hardware and schema shape.

Generating Postgres data in CI

A data generator belongs in the pipeline, not in a developer's shell history. In CI the requirements change: headless authentication, parseable output, deterministic exit codes, and no phone-home licensing.

CI: a fresh, production-shaped database on every push
$ weavori generate $TEST_DATABASE_URL --rows 1000 --output json

Weavori supports API keys for headless auth, plain and json output, standardized exit codes for pipeline branching, and a fingerprint-based schema cache so repeat runs skip introspection. Licenses are Ed25519-signed and validate offline — CI runners on restricted networks do not phone home. See the CI/CD guide for GitHub Actions, GitLab, CircleCI, and Jenkins examples.

Frequently asked questions

Quick, direct answers to the questions developers ask.

Ready to generate your first dataset?

Install Weavori in one command and connect to any PostgreSQL database.

$npm install -g @weavori/cli
macOS · Linux · Windows/No dependencies required

No credit card required. Start with a 14-day free trial of Pro, then free tier or subscribe.