sqlseed¶
Test data for SQLite and PostgreSQL, from your existing schema.
sqlseed fills existing tables with generated data. It infers rules for common columns such as names and email addresses, and lets you define application-specific values and relationships in Python or YAML. Core runs offline; AI is optional.
Choose how to use it¶
Use a Python 3.10+ virtual environment and install the entry point you need. Interface packages install Core as a dependency.
| I want to… | Install | Guide |
|---|---|---|
| Generate data from Python | python -m pip install sqlseed |
Python API |
| Use a browser | python -m pip install sqlseed-web |
Web workbench |
| Work in a terminal | python -m pip install sqlseed-cli |
CLI reference |
| Ask a model to suggest or repair rules | python -m pip install sqlseed-ai |
AI setup |
| Use rule-driven MCP tools | python -m pip install mcp-server-sqlseed |
MCP setup |
These pages describe the five-package layout introduced in 0.2.4. Upgrading an older installation? Read the migration guide. For development from source or optional dependencies, see installation.
Generate your first data¶
After installing sqlseed, save this as demo.py in a new directory and run
python demo.py. It creates a SQLite table and adds 100 users, with no repository
checkout or external database server:
import sqlite3
from contextlib import closing
import sqlseed
with closing(sqlite3.connect("demo.db")) as conn:
conn.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT NOT NULL
)
""")
conn.commit()
result = sqlseed.fill(
"demo.db",
table="users",
count=100,
provider="faker",
seed=42,
)
print(result.count, result.errors) # 100 []
Faker is included with Core. Each run appends another 100 rows; it does not clear
the table. Check both count and errors, because a failed run may retain earlier
committed batches. See support and maintenance for
constraint support, write behavior, and reproducibility conditions.
Try the browser or terminal¶
With sqlseed-web installed, run:
Open http://127.0.0.1:8630, connect to demo.db, select tables,
edit rules, and preview before generating. The command is included with the package;
no custom launcher is required. Follow the Web guide for details.
With sqlseed-cli installed, use the same database:
sqlseed inspect demo.db --table users --show-mapping
sqlseed preview demo.db -t users -n 5 --provider faker
sqlseed fill demo.db -t users -n 100 --provider faker --no-ai
Next steps¶
- User guide: YAML rules, generators, expressions, and multi-table configuration.
- Python API reference: functions, configuration models, and results.
- Project walkthrough: constraints, failure diagnosis, and replay.
- AI setup: model configuration and optional rule suggestions.
- Architecture: package boundaries and extension points.