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.

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[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

# 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
  • MySQL / MariaDB
  • SQLite

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.4.0.tar.gz (26.1 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.4.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for seedforge-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ba21ff5b42ce99b537616a7852001b1afbc988639a9473e631a56b2e3d3b7665
MD5 cf22d9b5353e38bcd9edc8b49cc2044e
BLAKE2b-256 2fdd715d6cdb029d485d6f6166180ffc65aed79fae025baf75ebd83745cdc18b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seedforge-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cde06b8403bda31fbb51101c82bed2c97f1a244c5ec73de974e307d2c818521
MD5 29ee6616fe8c3d7fca1c7b170dfe735d
BLAKE2b-256 9a9140083deb153be5fad8be9a10a0a4ea1298cc0ce93922c6bda0787739c038

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