northseadl/norix-skills / adb-mysql
adb-mysql
Verified阿里云 AnalyticDB (ADB) for MySQL 只读数据分析。 多维分析(计数/聚合/时间序列)、交叉验证、Schema 文档生成、多 Profile。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.1 KB |
| adbexecutable | script | 1.5 KB |
| agents/openai.yaml | config | 199 B |
| scripts/adb_core.py | script | 12.3 KB |
| scripts/analyze.py | script | 4.6 KB |
| scripts/config.py | script | 4.5 KB |
| scripts/credential_store.py | script | 9.1 KB |
| scripts/query.py | script | 1.4 KB |
| scripts/schema.py | script | 7.4 KB |
scripts/query.py
View on GitHub#!/usr/bin/env python3
"""ADB Analytics — SQL Query Executor (Read-Only).
Usage via unified CLI:
./adb query "SELECT ..." [-p profile] [-d database] [--format table|csv|json]
./adb query -f query.sql
"""
import argparse
import sys
import os
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, SCRIPT_DIR)
from adb_core import Log, connect, execute, output
def main():
parser = argparse.ArgumentParser(description="ADB 只读查询执行器")
parser.add_argument("sql", nargs="?", help="SQL 语句")
parser.add_argument("-f", "--file", help="从文件读取 SQL")
parser.add_argument("-p", "--profile", default=None, help="连接 profile")
parser.add_argument("-d", "--database", default=None, help="数据库名")
parser.add_argument("--format", default="table", choices=["table", "csv", "json"], help="输出格式")
args = parser.parse_args()
sql = args.sql
if args.file:
if not os.path.exists(args.file):
Log.err(f"SQL 文件不存在: {args.file}")
sys.exit(1)
with open(args.file, "r") as f:
sql = f.read()
if not sql:
Log.err("未提供 SQL 语句。使用 ./adb query \"SELECT ...\" 或 -f file.sql")
sys.exit(1)
conn = connect(args.profile, args.database)
try:
columns, rows = execute(conn, sql)
output(columns, rows, args.format)
finally:
conn.close()
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |