Skip to main content

One command to fill your database with realistic test data. Reads schema, resolves FK, generates smart data — no code needed.

Project description

SeedForge

PyPI version Python License: MIT

Database seeding tool. Connects to your DB, reads the schema, generates realistic data with valid foreign keys.

demo

pip install seedforge
seedforge connect postgresql://user:pass@localhost/mydb
seedforge generate --rows 1000

Why

I got tired of writing seed scripts by hand every time I start a new project. You know the drill — empty dashboards, nothing to test against, and if you copy prod data you're asking for GDPR trouble.

SeedForge reads your schema and figures out the rest. It knows that orders.user_id points to users.id, so it fills users first. It knows that a column called email should look like an email, not random gibberish.

Install

pip install seedforge          # PostgreSQL + SQLite
pip install seedforge[mysql]   # + MySQL/MariaDB
pip install seedforge[mssql]   # + SQL Server
pip install seedforge[ai]      # + AI providers
pip install seedforge[all]     # everything

Usage

# save connection (writes .seedforge.yaml)
seedforge connect postgresql://user:pass@localhost:5432/mydb
seedforge connect mysql://user:pass@localhost:3306/mydb
seedforge connect sqlite:///path/to/db.sqlite
seedforge connect mssql://sa:pass@localhost/mydb

# see what's in the database
seedforge inspect

# generate and insert
seedforge generate --rows 100

# just preview, don't touch the DB
seedforge generate --rows 10 --dry-run

# export instead of inserting
seedforge generate --rows 1000 --export sql
seedforge generate --rows 1000 --export json

# same data every time
seedforge generate --rows 100 --seed 42

# specific tables only (pulls in FK parents automatically)
seedforge generate --tables orders,payments --rows 50

# wipe tables first
seedforge generate --rows 100 --clean

AI mode

If you want smarter data (realistic product names, proper bios, etc.), you can plug in an API key. SeedForge auto-detects the provider:

seedforge ai-generate --api-key sk-ant-...   # Anthropic
seedforge ai-generate --api-key sk-...       # OpenAI
seedforge ai-generate --api-key AIza...      # Google Gemini
seedforge ai-generate --api-key gsk_...      # Groq

Or set an env var (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, GROQ_API_KEY) and just run seedforge ai-generate.

Only schema metadata goes to the API — table and column names, never your actual data.

How it works

  1. Connects to your database and reads information_schema (PostgreSQL/MySQL) or PRAGMA (SQLite)
  2. Builds a dependency graph from foreign keys, topological sort gives the insertion order
  3. For each column, picks a generator based on the name — email gets a realistic email, price gets a decimal, created_at gets a recent timestamp, and so on (80+ patterns)
  4. Foreign key columns get real IDs from already-generated parent rows
  5. Batch inserts everything in a single transaction

What it recognizes

Some examples — there are 80+ patterns total:

Column Data
email john.smith@example.com
phone +1-555-0123
first_name / last_name John / Smith
price, amount 49.99
role admin, user, moderator
status active, pending, completed
created_at recent datetime
is_active true (biased)
password SHA-256 hash
avatar_url https://picsum.photos/...
uuid valid v4 UUID

It's also context-aware: name in a users table gives person names, in organizations — company names, in products — product names.

Config

seedforge connect creates a .seedforge.yaml:

db_url: postgresql://user:pass@localhost:5432/mydb
default_rows: 100
default_schema: public
seed: 42
exclude_tables:
  - _prisma_migrations
  - django_migrations

Migration tables (_prisma_migrations, django_migrations, alembic_version, etc.) are excluded automatically.

Databases

  • PostgreSQL (+ CockroachDB)
  • MySQL / MariaDB
  • SQLite
  • Microsoft SQL Server

Contributing

PRs welcome. See CONTRIBUTING.md.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seedforge-0.5.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seedforge-0.5.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file seedforge-0.5.0.tar.gz.

File metadata

  • Download URL: seedforge-0.5.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for seedforge-0.5.0.tar.gz
Algorithm Hash digest
SHA256 674d2f8024949c53e86acdb42f6c23498a48f0f1421dcb9b4323f1a533fbbcac
MD5 e5bc7f61dc85953a2ea37cf88cb48963
BLAKE2b-256 1af9e7469d0ec935ca447d1c43c89b7bac06951ec4b688d5ffa0bbff3a5fa115

See more details on using hashes here.

File details

Details for the file seedforge-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: seedforge-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for seedforge-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bcb52cec03e25691360c9e5c8394645be948a58da4c643186f71edc683a1ba7
MD5 4f02ec3ca4b9dc89c355e91d6cfe4911
BLAKE2b-256 6defcc2170d326e61c6d8ead706d64950597e94276ea1f7e25c9e5c292ca1344

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page