Skip to content

northseadl/norix-skills / adb-mysql

adb-mysql

Verified

阿里云 AnalyticDB (ADB) for MySQL 只读数据分析。 多维分析(计数/聚合/时间序列)、交叉验证、Schema 文档生成、多 Profile。

FileKindSize
SKILL.mdskill md3.1 KB
adbexecutablescript1.5 KB
agents/openai.yamlconfig199 B
scripts/adb_core.pyscript12.3 KB
scripts/analyze.pyscript4.6 KB
scripts/config.pyscript4.5 KB
scripts/credential_store.pyscript9.1 KB
scripts/query.pyscript1.4 KB
scripts/schema.pyscript7.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()
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall