スキル一覧に戻る
MUmerRazzaq

test-data-seeding

by MUmerRazzaq

0🍴 0📅 2025年12月25日
GitHubで見るManusで実行

SKILL.md


Test Data Seeding Skill

This skill provides a complete framework for seeding your database with realistic test data using Python and the Faker library. It is designed to be customizable for your specific data models and ORM.

Core Features

  • Realistic Data Generation: Uses the Faker library.
  • Idempotent Seeding: Scripts are designed to be run multiple times without creating duplicate data.
  • Relationship-Aware: Handles generation of data with parent-child relationships (e.g., users and their tasks).
  • Environment-Specific: Configure different data volumes for dev, test, and demo environments.
  • Performance Optimized: Uses bulk inserts where possible.
  • Data Cleanup: Includes a script to reset the database.
  • Versioning: Seed data generation is deterministic and can be versioned by committing the scripts.

How to Use This Skill

The workflow is as follows:

  1. Configure Your Models: Update references/data_models.md and the model import sections in the Python scripts.
  2. Customize the Scripts: Modify scripts/reset_db.py and scripts/seed.py to work with your specific ORM and database connection.
  3. Run the Seeding Command: Use the scripts/invoke_seeding.sh command to reset and/or seed your database.

Bundled Resources

Scripts (scripts/)

  • invoke_seeding.sh: The main CLI for this skill. Use it to run the seeding process.

    # Seed the 'dev' environment
    bash scripts/invoke_seeding.sh dev
    
    # Reset the database and then seed the 'demo' environment
    bash scripts/invoke_seeding.sh demo --reset
    

    Make sure the script is executable: chmod +x scripts/invoke_seeding.sh

  • seed.py: The core data generation and seeding script.

    • TODO: You must configure your database connection and ORM logic in the TODO sections at the top of the file.
    • You can customize the number of records for each environment in the SEED_COUNTS dictionary.
  • reset_db.py: A script to wipe all data from your tables.

    • TODO: You must configure this script with your database connection and provide your models in the correct order for deletion to respect foreign key constraints.

References (references/)

  • data_models.md: A template document to define your database schema. You should replace the example content with your actual models. This helps in understanding the data structure when customizing the seeding script.

  • faker_examples.md: A handy reference guide with examples of how to use the Faker library to generate different kinds of data. Refer to this when you want to customize the data being generated in scripts/seed.py.

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です