Skip to main content

Schema-aware seed-data orchestrator

Project description

Katcha

A database schema-aware fake data seeding tool. Katcha inspects your database schema, understands foreign key relationships, and generates realistic test data in the correct order.

Features

  • Schema-aware seeding: Automatically detects foreign key relationships and seeds tables in topological order
  • Smart data generation: Uses column names and types to generate contextually appropriate fake data (emails, names, addresses, etc.)
  • Configuration-driven: Control how many rows to seed per table via a simple YAML config
  • Constraint handling: Respects unique constraints, composite primary keys, and nullable columns
  • Self-referential support: Handles tables with self-referential foreign keys (e.g., parent-child relationships)

Installation

pip install katcha

Quick Start

1. Initialize configuration

Point katcha at your database to generate a configuration file:

katcha init postgresql://user:pass@localhost/mydb

This creates a katcha.yml file:

version: 1

database:
  engine: postgresql
  host: user:pass@localhost/mydb

schema:
  users: 10
  posts: 10
  comments: 10

2. Customize row counts

Edit katcha.yml to set how many rows you want per table:

schema:
  users: 50
  posts: 200
  comments: 500

3. Seed your database

katcha seed

Katcha will insert fake data in the correct order, respecting all foreign key relationships.

Commands

katcha init <database_url>

Initialize a new katcha configuration by inspecting a database schema.

Arguments:

  • database_url: Database connection URL (e.g., postgresql://user:pass@host/db, sqlite:///test.db)

Options:

  • -o, --output: Output file path (default: katcha.yml)
  • -r, --rows: Default number of rows per table (default: 10)

katcha build

Re-inspect the database schema and update configuration with new tables.

Options:

  • -c, --config: Path to config file (default: katcha.yml)
  • -r, --rows: Default rows for new tables (default: 10)

katcha seed

Seed the database with fake data based on configuration.

Options:

  • -c, --config: Path to config file (default: katcha.yml)

Supported Databases

Katcha works with any database supported by SQLAlchemy:

  • PostgreSQL
  • MySQL / MariaDB
  • SQLite
  • Microsoft SQL Server
  • Oracle

Smart Data Generation

Katcha generates contextually appropriate data based on column names:

Column Pattern Generated Data
email Realistic email addresses
first_name, last_name Human names
phone, mobile Phone numbers
address, city, state Location data
url, website URLs
created_at, updated_at Timestamps
price, cost, amount Monetary values
description Paragraphs of text
uuid, guid UUIDs
password, hash SHA256 hashes

For columns without name matches, data is generated based on SQL type.

Requirements

  • Python 3.11+
  • Database driver for your database (e.g., psycopg2 for PostgreSQL)

License

MIT License - see LICENSE for details.

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

katcha-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

katcha-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file katcha-0.1.0.tar.gz.

File metadata

  • Download URL: katcha-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for katcha-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cc6d8cbc09c54054518b201799fadbc753ad4a8ece4cf35e258683763780b43
MD5 e9543582aa017e8c151c2179ea509555
BLAKE2b-256 e94419e0bd77f2f80cf36e70f45a78b436382e3151dbfd433c0fd6a6dacd3371

See more details on using hashes here.

File details

Details for the file katcha-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: katcha-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for katcha-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e1b47022f7336b3e04c485d520ae01460a4422e5915e2397c7aeba9644fbe3f
MD5 5933df9001bd3fa152f5a4e51d45a489
BLAKE2b-256 9c19e7ed72817ebc39317a384945dac0ba7c399d9575e000d0414e90fabbafd3

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