SQL Database Toolkit

👤 ericlooi504 📦 v1.0.0 ⭐ 4.2 ⬇️ 636 下载
💻 开发编程 免费

📖 技能介绍


name: sql-db-toolkit description: Comprehensive SQL database toolkit for querying, schema inspection, data export, and migration management. Use when the user wants to: (1) Query a database with SELECT/INSERT/UPDATE/DELETE, (2) Inspect table schemas, indexes, and foreign keys, (3) Export data to CSV/JSON, (4) Generate SQL migrations or schema diffs, (5) Run database backups and restore, (6) Analyze query performance with EXPLAIN, (7) Work with SQLite, PostgreSQL, MySQL, or any sqlalchemy-compatible database.


SQL Database Toolkit

Query, inspect, export, and manage databases via conversation. Supports SQLite (no setup) and PostgreSQL/MySQL (with connection string).

Quick Start

# SQLite - no setup needed
python3 skills/sql-db-toolkit/scripts/db_query.py --db my.db --sql "SELECT * FROM users LIMIT 5"

# PostgreSQL
python3 skills/sql-db-toolkit/scripts/db_query.py --conn "postgresql://user:pass@host:5432/db" --sql "SELECT table_name FROM information_schema.tables"

Common Commands

Query Database

python3 skills/sql-db-toolkit/scripts/db_query.py --db my.db --sql "SELECT id, name, email FROM users WHERE active = 1" --format table

Inspect Schema

python3 skills/sql-db-toolkit/scripts/db_schema.py --db my.db

Export to CSV

python3 skills/sql-db-toolkit/scripts/db_export.py --db my.db --sql "SELECT * FROM orders" --output orders.csv

Backup Database

7w4.net提供免费和付费技能下载。

python3 skills/sql-db-toolkit/scripts/db_backup.py --db my.db --output backup/

Scripts

Script Purpose
db_query.py Execute SQL queries with formatted output (table/JSON/CSV)
db_schema.py Inspect tables, columns, indexes, FKs, triggers
db_export.py Export query results to CSV, JSON, or SQL dump
db_backup.py Backup SQLite DB or dump PostgreSQL/MySQL
db_migrate.py Compare schemas, generate migration SQL

Connection Strings

# SQLite
sqlite:///path/to/db.sqlite

# PostgreSQL
postgresql://user:password@host:5432/database

# MySQL
mysql+pymysql://user:password@host:3306/database

Options

All scripts support --help for full argument reference. Key shared options:

  • --db <path> — SQLite database file path
  • --conn <url> — SQLAlchemy connection string
  • --sql <query> — SQL query to execute
  • --format table|json|csv — Output format
  • --verbose — Show execution time and row counts

🤖 AI 评测

这是一个功能较全面的数据库工具包,能满足基本的查询、查看表结构、导出数据和备份等需求。文档说明详细清晰,新手容易上手,多数据库支持也是亮点。但存在一些功能缩水问题:文档描述的部分功能实际上不可用,不同数据库的支持程度参差不齐,远程数据库的功能明显弱于 SQLite。整体质量中等偏上,日常简单使用够用,但如果需要处理复杂的跨数据库场景,可能会遇到功能缺失的问题。

📊 多维度评分

适应性4.6
规范性4.1
有效性4.1
可靠性4.3
可信度4.3

📁 包含文件 (6 个)

📄 SKILL.md 2.4 KB
📄 _meta.json 133 B
📄 scripts/db_backup.py 1.5 KB
📄 scripts/db_export.py 2.4 KB
📄 scripts/db_query.py 3.6 KB
📄 scripts/db_schema.py 4.3 KB