Open source · MIT licensed

Database seeding
that respects your
foreign keys.

seedloom reads your real Postgres schema and uses an LLM - Claude, OpenAI, Gemini, or any OpenAI-compatible endpoint - to generate realistic seed data, with referential integrity enforced structurally, not hoped for. Now with pgvector support and an MCP server for agent workflows.

$pip install seedloom
Resolved seed order
seedloom foreign-key aware seed ordering diagram users id · name · email orders user_id → users.id order_items order_id → orders.id FK enum: [1,2,3…]

Faker fills columns. seedloom understands relationships.

Generic fakers have no idea your orders.user_id needs to point at a real row. seedloom does.

Real schema introspection

Reads live Postgres via information_schema - works with Prisma, Django, Rails, or raw SQL migrations.

Structural FK integrity

Foreign key columns are constrained to a JSON Schema enum of real inserted parent IDs. No dangling references, ever.

Automatic seed ordering

Topologically sorts your tables so parents are always seeded before dependents - no manual insert order.

Enum & constraint aware

Respects NOT NULL, UNIQUE, and Postgres enum types when generating values - not just column type guesses.

Realistic, not robotic

Your configured LLM generates plausible names, matching emails, believable amounts - not "test1", "test2", "test3".

Skips DB-owned columns

Auto-detects SERIAL, gen_random_uuid(), and now() defaults - lets the database do what it already does.

pgvector support

Detects vector, halfvec, and sparsevec columns and their dimensions automatically, filling them with unit-length vectors so indexes and similarity queries work out of the box.

MCP server included

Ships a seedloom-mcp server alongside the CLI so Claude Code, Cursor, and other MCP clients can introspect your schema and seed data directly from the agent.

Four steps, fully automated

01

Introspect

Query information_schema and pg_catalog for tables, types, FKs, and enums.

02

Order

Topologically sort tables so dependencies always seed first.

03

Generate

Your chosen provider fills a per-table JSON Schema via structured tool-use output.

04

Insert

Batch insert and track assigned PKs for the next table's FK pool.

Install and run in under a minute

Needs a Postgres DATABASE_URL and an API key for whichever provider you pick - Claude by default, or swap in OpenAI, Gemini, Groq, Together, Fireworks, OpenRouter, DeepSeek, Mistral, or a local model via Ollama/LM Studio/vLLM.

Install
Init
Run
Dry run
MCP
# install from PyPI - only the SDK you need
pip install seedloom[anthropic] # or [openai], [gemini], [ollama], [all]

# set your credentials
export DATABASE_URL="postgresql://user:pass@localhost:5432/mydb"
export SEEDLOOM_PROVIDER="anthropic" # default; see Providers
export ANTHROPIC_API_KEY="sk-ant-..."
# introspect your schema and cache it locally
seedloom init
# generate + insert 20 rows per table, in FK-safe order
seedloom run --rows 20

# only specific tables
seedloom run --rows 50 --tables users,products

# override the provider/model for a single run
seedloom run --provider gemini --model gemini-2.5-flash --rows 20
seedloom run --provider ollama --model llama3.1 --rows 20
# preview generated data without touching the database
seedloom run --rows 5 --dry-run
# install the MCP extra, then point your MCP client at it
pip install seedloom[mcp]

// .mcp.json / client config
{
  "mcpServers": {
    "seedloom": {
      "command": "seedloom-mcp",
      "env": { "SEEDLOOM_PROVIDER": "gemini", "GEMINI_API_KEY": "..." }
    }
  }
}
☕ Support seedloom