SQL · DDL · PostgreSQL · MySQL

SQL test data generator: FK-consistent data from your CREATE TABLE schema.

Paste your CREATE TABLE statements, a pg_dump or mysqldump schema, or connect PostgreSQL/MySQL directly. SeedBase parses columns, primary keys and foreign keys, inline REFERENCES, table-level constraints and ALTER TABLE, and generates INSERT statements that load with constraints enabled, in topological order.

Free tier · no card · EU-hosted · zero trackers

Other stacks: Django test data · Prisma seed data · PostgreSQL generator

CREATE TABLE dump in, FK-consistent INSERT statements out

Column-level REFERENCES, table-level FOREIGN KEY constraints and ALTER TABLE ... ADD FOREIGN KEY are all recognized. Column generators are inferred from names and types: email becomes an email, city a city, price a plausible amount, and serial/integer primary keys stay sequences.

Paste a small schema like this:

-- PostgreSQL DDL
CREATE TABLE users (
  id    SERIAL PRIMARY KEY,
  email TEXT NOT NULL,
  city  TEXT
);

CREATE TABLE orders (
  id      SERIAL PRIMARY KEY,
  user_id INT NOT NULL REFERENCES users(id),
  total   DECIMAL(10,2)
);

SeedBase reads the declared foreign key, generates the parent rows first, then the children, and emits INSERT statements in topological order so they load with constraints enabled:

-- users insert before orders, every user_id resolves
INSERT INTO users (id, email, city) VALUES
  (1, 'amelia.brooks@example.com', 'Manchester'),
  (2, 'diego.ferraro@example.net', 'Turin');

INSERT INTO orders (id, user_id, total) VALUES
  (1, 1, 48.20),
  (2, 1, 162.99),
  (3, 2, 9.50);

The same parser reads MySQL DDL (AUTO_INCREMENT, backtick quoting, ENGINE=InnoDB foreign keys). On a schema with hundreds of tables, the topological sort is what keeps the load order correct without you hand-editing it.

What you get

FK-consistent

Every foreign key resolves

Children reference parents that exist, including self-references (parent_id) and one-to-one relations. Inserts come out in topological order, so the SQL loads into a constrained schema as-is.

realistic

Production-like distributions

Not every user has exactly 5 orders: long-tail and normal distributions create the skew where pagination and N+1 bugs actually show up.

current

Time-aware data

Timestamps generate relative to today, "last 30 days" dashboards stay populated instead of going empty as fixtures age.

reproducible

Deterministic per seed

Same seed, same data, reproducible CI runs. Export the generation config as JSON and commit it next to your migrations.

We tested the parser against real PostgreSQL and MySQL dumps, inline REFERENCES, table-level and ALTER TABLE foreign keys, self-references, and a real 20-app Django project with 226 tables. Data loads with constraints enabled, on real schemas, not toy ones.

Generate a SQL file from your schema

Import your CREATE TABLE schema once as a project, then generate a .sql file from the Node client. download({ format: 'sql' }) returns the INSERT statements in foreign-key-safe order, ready for psql or the mysql client.

// gen-sql.mjs
import { SeedbaseClient } from "@seedbase/client";
import { writeFile } from "node:fs/promises";

const client = new SeedbaseClient({ token: process.env.SEEDBASE_TOKEN });

// generate, then download as a .sql file of INSERT statements
const gen = await client.generate(process.env.SEEDBASE_PROJECT, { seed: 42, wait: true });
await writeFile("seed.sql", await client.download(gen.id, { format: "sql" }));

Prefer a CLI? The same generation is one command, with output piped to a file. See the docs for the exact flags and authentication.

Push data straight into PostgreSQL or MySQL

When you do not want a file at all, connect a live database and push the generated rows directly. SeedBase inserts in dependency order, so a constrained PostgreSQL or MySQL schema stays valid the whole way through, no deferred constraints, no disabling foreign keys.

# or load a generated file yourself
psql "$DATABASE_URL" -f seed.sql        # PostgreSQL
mysql -u app -p appdb < seed.sql        # MySQL

Direct push and live-database connections are on the paid plans; the free tier downloads files. The direct push is the same engine that handles FK-complete subsetting, so a pushed subset still satisfies every foreign key.

Deterministic SQL test data for CI

Pass a seed and the same schema produces the same rows on every run. Generate the SQL in a pipeline step and load it before the suite, so a failing test reproduces locally with the same seed: 42.

# .github/workflows/test.yml
- run: node gen-sql.mjs
- run: psql "$DATABASE_URL" -f seed.sql
- run: pytest        # or your test runner

Because the data is keyed off the seed, snapshot tests stay stable across runs and a CI failure is reproducible on your machine. A pinned reference date keeps "last 30 days" timestamps identical too.

PostgreSQL and MySQL: dialect details

The parser is dialect-aware, so the same workflow covers both major engines and their quirks:

postgresql

PostgreSQL test data generator

SERIAL and IDENTITY primary keys, pg_dump output, double-quoted identifiers, inline REFERENCES and ALTER TABLE ... ADD CONSTRAINT foreign keys, arrays and enums. INSERTs export in topological order so they load with constraints on.

mysql

MySQL test data generator

AUTO_INCREMENT, backtick quoting, mysqldump output, ENGINE=InnoDB foreign keys and composite keys. Generated rows respect FK order so they load into InnoDB without disabling FOREIGN_KEY_CHECKS.

Same blueprint, different export target. If your schema lives in an ORM instead of raw DDL, SeedBase also reads Django models.py and Prisma schema.prisma.

SQL test data generator: FAQ

How do I generate test data from a CREATE TABLE schema?

Paste your CREATE TABLE statements or a pg_dump / mysqldump schema into SeedBase. It parses columns, primary keys and foreign keys (inline REFERENCES, table-level FOREIGN KEY and ALTER TABLE), then generates INSERT statements you can download as a .sql file or push straight into a database.

Which SQL dialects are supported?

PostgreSQL, MySQL and SQLite DDL, including backtick and bracket quoting, AUTO_INCREMENT and SERIAL, and inline or constraint-style foreign keys. Live connections work for PostgreSQL and MySQL.

Does the generated SQL load with foreign key constraints enabled?

Yes. Tables generate and export in topological FK order, every reference points at an existing row, and self-referencing tables only reference earlier rows. The INSERT statements load into a constrained schema as-is, no deferred constraints needed.

Can SeedBase push directly into my database instead of writing a file?

Yes. On a paid plan you can connect a PostgreSQL or MySQL database and push generated rows straight in, in dependency order, or download a .sql file and load it with psql or the mysql client yourself.

Is the generated data deterministic for CI?

Yes. Pass a seed (for example seed: 42) and the same schema produces the same rows on every run, so a failing test reproduces locally with the same seed. A pinned reference date keeps timestamps reproducible too.

Can it also use my existing data?

Yes. Connect the database directly and SeedBase profiles real distributions from sample rows, or paste INSERT statements and it learns from those values. For production data there is GDPR-grade format-preserving masking.

How many rows can I generate, and what does it cost?

The free tier covers small schemas with no credit card; smart row counts scale themselves to your plan so the first click always works. Paid plans start at €19/month and raise per-generation and monthly limits.

Two minutes to a fully populated database

Sign up, import your schema, generate. No sales call, no credit card, the free tier is enough for a real first impression.

  • FK-consistent
  • Realistic distributions
  • SQL / CSV / JSON
  • EU-hosted
Start free

Other stacks: Django test data · Prisma seed data  ·  Compare: vs Mockaroo  ·  GDPR anonymization · docs