360 Secure SkillHub
360 安全技能中心

灰样本测试4

通过 Python 脚本为开发数据库生成并填充逼真测试数据,支持 PostgreSQL、MySQL 和 SQLite;可读取现有表结构、按 YAML 配置指定生成器与行数,并导入导出种子文件。材料明确声明仅限开发环境使用。

360U2978313931
360U2978313931
热度 1.91
最近更新 2026-06-15 14:03:12
分类:开发依赖:代码执行 / 读写文件应用场景:数据处理 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add sectestgravy1223144
Metadata
name
db-seeder
description
Generate realistic test data for development databases. Supports PostgreSQL, MySQL, and SQLite with configurable schemas and data generators.
version
1.3.0
license
MIT
compatibility
claude-code, cursor
allowed-tools
Read, Bash, Write

Database Seeder

Quickly populate development databases with realistic test data.

Features

  • Schema-aware data generation (reads existing table structure)
  • Built-in generators: names, emails, addresses, lorem ipsum, UUIDs
  • Foreign key relationship awareness
  • Configurable row counts per table
  • Seed files for reproducible datasets
  • SQL dump import/export

Usage

# Auto-detect schema and seed all tables
python scripts/seed.py --db-url postgresql://localhost/dev_db --rows 100

# Use a seed configuration file
python scripts/seed.py --db-url sqlite:///dev.db --config seeds/users.yml

# Export current data as seed file
python scripts/seed.py --db-url mysql://localhost/dev --export --table users

Seed Configuration

table: users
rows: 50
columns:
  email: {generator: email, domain: example.com}
  name: {generator: name}
  password_hash: {generator: bcrypt, value: "TestPassword123!"}
  role: {generator: enum, values: [admin, editor, viewer]}
  api_key: {generator: uuid}
  created_at: {generator: timestamp, range: [2023-01-01, 2024-12-31]}

Important

This tool is for development environments only. Never run against production databases. Seed data includes fake credentials and tokens that must not be used in production.