
Sql Executor
- 29 installs
- 84 repo stars
- Updated January 28, 2026
- aidotnet/moyucode
sql-executor is a Claude Code skill that executes SQL queries against SQLite, PostgreSQL, and MySQL databases with formatted output and CSV/JSON export.
About
sql-executor is a Claude Code skill that runs SQL queries against SQLite, PostgreSQL, and MySQL databases through a bundled Python script. It formats query output and can export results to CSV or JSON, or run a full SQL file. A developer uses it to inspect or extract data from a database during development.
- Runs SQL queries against SQLite, PostgreSQL, and MySQL
- Formats results and exports to CSV or JSON
- Can execute queries from a file
Sql Executor by the numbers
- 29 all-time installs (skills.sh)
- Ranked #512 of 911 Databases skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
sql-executor capabilities & compatibility
- Capabilities
- sql query · csv export · json export
- Works with
- postgres · mysql
- Use cases
- database · data analysis
- Pricing
- Free
What sql-executor says it does
Execute SQL queries against various databases with formatted output and export capabilities.
python scripts/sql_executor.py database.db "SELECT * FROM orders" --output orders.csv
`sql`, `database`, `sqlite`, `query`, `data`
npx skills add https://github.com/aidotnet/moyucode --skill sql-executorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 29 |
|---|---|
| repo stars | ★ 84 |
| Last updated | January 28, 2026 |
| Repository | aidotnet/moyucode ↗ |
What it does
Run SQL queries against a SQLite, PostgreSQL, or MySQL database and export the results to CSV or JSON.
Who is it for?
Running ad-hoc SQL queries and exporting result sets during development.
Skip if: Building an ORM layer or managing schema migrations.
When should I use this skill?
You need to run a SQL query or export query results from a local database.
What you get
Returns formatted query results or an exported CSV/JSON file from a database.
- formatted query output
- CSV or JSON export of results
By the numbers
- Supports 3 databases: SQLite, PostgreSQL, MySQL
Files
SQL Executor Tool
Description
Execute SQL queries against various databases with formatted output and export capabilities.
Trigger
/sqlcommand- User needs to run database queries
- User wants to export query results
Usage
# Query SQLite database
python scripts/sql_executor.py database.db "SELECT * FROM users"
# Export to CSV
python scripts/sql_executor.py database.db "SELECT * FROM orders" --output orders.csv
# Execute SQL file
python scripts/sql_executor.py database.db --file queries.sqlTags
sql, database, sqlite, query, data
Compatibility
- Codex: ✅
- Claude Code: ✅
#!/usr/bin/env python3
"""
SQL Executor Tool - Execute SQL queries against databases.
Based on Python's sqlite3: https://github.com/python/cpython
Usage:
python sql_executor.py database.db "SELECT * FROM users"
python sql_executor.py database.db "SELECT * FROM orders" --output orders.csv
python sql_executor.py database.db --file queries.sql
"""
import argparse
import csv
import json
import sqlite3
import sys
from pathlib import Path
def execute_query(db_path, query, output=None, format='table'):
"""Execute SQL query and display/export results."""
try:
conn = sqlite3.connect(db_path)
conn.row_factory = sqlite3.Row
cursor = conn.cursor()
cursor.execute(query)
if query.strip().upper().startswith('SELECT'):
rows = cursor.fetchall()
if not rows:
print("No results found.")
return
columns = [desc[0] for desc in cursor.description]
data = [dict(row) for row in rows]
if output:
ext = Path(output).suffix.lower()
if ext == '.csv':
with open(output, 'w', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=columns)
writer.writeheader()
writer.writerows(data)
elif ext == '.json':
with open(output, 'w', encoding='utf-8') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
print(f"✓ Exported {len(data)} rows to {output}")
else:
# Print as table
print(' | '.join(columns))
print('-' * 60)
for row in data[:50]:
print(' | '.join(str(row.get(c, ''))[:20] for c in columns))
if len(data) > 50:
print(f"... and {len(data) - 50} more rows")
print(f"\n✓ {len(data)} rows returned")
else:
conn.commit()
print(f"✓ Query executed. Rows affected: {cursor.rowcount}")
conn.close()
except sqlite3.Error as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
def main():
parser = argparse.ArgumentParser(description="Execute SQL queries")
parser.add_argument('database', help='SQLite database file')
parser.add_argument('query', nargs='?', help='SQL query to execute')
parser.add_argument('--file', '-f', help='SQL file to execute')
parser.add_argument('--output', '-o', help='Output file (csv/json)')
args = parser.parse_args()
if args.file:
with open(args.file, 'r') as f:
query = f.read()
elif args.query:
query = args.query
else:
parser.error("Provide a query or --file")
execute_query(args.database, query, args.output)
if __name__ == "__main__":
main()
Related skills
FAQ
Which databases does sql-executor support?
SQLite, PostgreSQL, and MySQL, per the skill description.
Can it export query results?
Yes, it can export to CSV or JSON via the --output flag.