Skip to main content

sqlseed

Test data for SQLite and PostgreSQL, from your existing schema.

English · 简体中文

PyPI Python 3.10+ CI License: AGPL v3

Quick start · Web workbench · CLI · Documentation

sqlseed fills existing database tables with generated test data. Start with inferred rules for common columns such as names and email addresses, then specify the ranges, choices, or relationships your application needs in Python or YAML.

  • Prepare development and test databases: generate rows in batches and coordinate supported foreign-key dependencies.
  • Keep data rules reusable: save configuration, preview samples, and use a seed to reproduce a run under the same conditions.
  • Choose your interface: use the Python API, terminal, browser, or MCP tools. The Core runs offline; AI assistance is optional.

Choose an entry point

Requires Python 3.10+. Use a virtual environment and install the package for the interface you want; you do not need to install every row below. Interface packages install Core as a dependency.

This README describes version 0.2.5. Check Releases for publication status; the source installation guide covers unpublished candidates.

I want to… Install Start here
Generate data from Python python -m pip install sqlseed Quick start
Use a browser python -m pip install sqlseed-web Web workbench
Work in a terminal python -m pip install sqlseed-cli Command line
Ask a model to suggest or repair rules python -m pip install sqlseed-ai AI assistance
Use rule-driven tools from an MCP client python -m pip install mcp-server-sqlseed MCP setup

Faker is included with Core and is selected explicitly in the examples below. Mimesis is optional: install it with python -m pip install 'sqlseed[mimesis]'. For an older installation, see the upgrade guide.

Quick start

Install Core in your Python environment:

python -m pip install sqlseed

Save the following as demo.py in a new directory and run python demo.py. It creates a SQLite table and adds 100 users. It needs no repository checkout, API key, 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 []

Names and email addresses are inferred from the columns. The database assigns the primary keys. Each run appends another 100 rows; it does not clear the table. Check both result.count and result.errors after generation.

In version 0.2.5, sqlseed.FillOptions(provider="faker", seed=42) can share generation settings across fill(..., options=settings) calls. Existing individual keywords remain supported; see the Python API reference.

To inspect samples without writing rows:

import sqlseed

rows = sqlseed.preview("demo.db", table="users", count=3, provider="faker")
for row in rows:
    print(row)

Reuse your rules with YAML

For the same demo.db, save this as generate.yaml. Here the column generators are explicit, so the rules can be reviewed and reused:

db_path: demo.db
provider: faker
locale: en_US
tables:
  - name: users
    count: 100
    seed: 42
    columns:
      - name: name
        generator: name
      - name: email
        generator: email

Run it from the same directory:

import sqlseed

for result in sqlseed.fill_from_config("generate.yaml"):
    print(result.count, result.errors)

The configuration guide covers value ranges, weighted choices, derived columns, and relationships between tables. See the generator reference for supported names and parameters.

Web workbench

python -m pip install sqlseed-web
sqlseed-web

Open http://127.0.0.1:8630, connect to an existing database (such as the demo.db above), select tables, edit rules, preview, and generate. The sqlseed-web command is installed with the package; no custom startup script or source checkout is required.

The workbench includes saved configurations, relationship views, and run history. AI is optional, and manual editing, preview, and generation work without it. Version 0.2.5 offers Simplified Chinese and English from the top bar. Changing the interface language keeps your edits and does not change the data language and region used for generation. See the Web guide for connection settings, optional components, and deployment requirements.

Command line

Install the CLI, then use the database created in the quick start:

python -m pip install sqlseed-cli
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

Use sqlseed --help or sqlseed <command> --help for options. The CLI also supports configuration templates, snapshots, and replay; see the CLI reference. Installing Core alone provides the Python API; sqlseed-cli supplies the sqlseed command.

PostgreSQL

Install the PostgreSQL driver extra:

python -m pip install 'sqlseed[postgres]'

For an existing database and table, supply the connection URL explicitly:

import sqlseed

result = sqlseed.fill(
    url="postgresql+psycopg://user:password@localhost:5432/app",
    table="users",
    count=100,
    provider="faker",
)
print(result.count, result.errors)

Do not pass both a SQLite path and url. For supported foreign-key layouts and entry-point differences, read the support scope.

Optional AI assistance

sqlseed-ai adds commands for suggesting generation rules and repairing existing configurations. Install it, then configure a model backend using the AI setup guide.

Command Use it to…
sqlseed ai-suggest Suggest rules for one table
sqlseed ai-analyze Analyze selected tables or a database
sqlseed auto-heal Repair rules in an existing, structurally valid YAML configuration

The analysis and repair workflow can infer rules for supported CHECK patterns, such as enums, ranges, and relationships between columns. Other constraints can require explicit rules or model suggestions; this is not a solver for arbitrary SQL CHECK expressions. Review the candidate configuration and verify the data before relying on it.

See the AI command reference and backend and validation guide. For model-assisted MCP tools, use the separate server provided by sqlseed-ai[mcp]; MCP setup explains both servers.

Working with your own database

  • Create tables first. sqlseed reads existing schemas. Required parent rows must already exist or be generated earlier in the configuration.
  • Check the outcome. A failed Core or CLI run can retain earlier committed batches. Inspect count and errors before retrying.
  • Keep reproducibility conditions consistent. A seed alone does not guarantee identical output across dependency versions, providers, configurations, or initial database contents.

Complex CHECK constraints and composite foreign keys have database-specific limits. See support and maintenance for the supported scope and write behavior.

Documentation

Next step Read
Configure generators, expressions, and multi-table data User guide
Use fill, FillOptions, preview, connect, fill_from_config, or load_config Python API reference
Try a complete multi-table example Order workflow
Understand package boundaries and extension hooks Architecture
Upgrade an existing installation Migration guide
Check published changes Releases

Contributing

See CONTRIBUTING.md for source installation, development checks, and contribution guidelines. Report bugs with a minimal schema, your configuration, package versions, and the full error in GitHub Issues.

License

AGPL-3.0-or-later.

Metadata

Release files for sqlseed 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlseed 0.2.5
File Size Uploaded
sqlseed-0.2.5.tar.gz 231.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlseed 0.2.5
File Interpreter ABI Platform
sqlseed-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 474.7 kB

Release files / sqlseed-0.2.5.tar.gz

Download URL sqlseed-0.2.5.tar.gz
Size 231.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c075038cedef2d2f1b49c146bf5ebab04108272445d7da1db2ed7bbc797ec647
BLAKE2b-256 checksum
How to use checksums
ea06044326b7f810a9dc697ecf6b41b8ae777f170aad14813f7a02e70918cafd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / sqlseed-0.2.5-py3-none-any.whl

Download URL sqlseed-0.2.5-py3-none-any.whl
Size 243.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55c91811776dbaf53d6acc3e7eedef9064ae6d28ff67d0dd3e43288493a01301
BLAKE2b-256 checksum
How to use checksums
b7403c9d84b034afdc24f02479968003f4a0bb4bd893703b43ee145ffdd1971d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.6

2 release files

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.20

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page