Skip to main content

English | 简体中文

analyticdb-mysql-cli

AI-Agent-friendly database CLI for AnalyticDB MySQL. Default JSON output, stateless invocations, and a consistent error format make it easy for agents to run SQL and inspect schema reliably.

AnalyticDB MySQL is Alibaba Cloud's cloud-native data warehouse product.

Why analyticdb-mysql-cli

  • Agent-friendly: Any agent that can run shell commands can use analyticdb-mysql-cli via the adbmysql-cli command (the analyticdb-mysql-cli command is the same entry point, useful for which analyticdb-mysql-cli–style checks); output is JSON by default, and the adbmysql-cli ai-guide command provides a self-description of analyticdb-mysql-cli usage for agents.
  • Safety: Row limits, write guards, and masking reduce risk when agents or scripts operate on live data.
  • Unified interface: Execute SQL via CLI, without interactive prompts or session state.

Features

  • JSON by default: All commands emit structured JSON; use --format table|csv|jsonl for human-readable output.
  • Row limits: LIMIT required when result exceeds 1000 rows.
  • Write safeguards: Writes require --write; DELETE/UPDATE without WHERE are disallowed.
  • Sensitive-field masking: Columns such as phone, email, password, id_card are auto-masked in query results.
  • Operation history: All commands are logged to ~/.adbmysql/sql-history.jsonl; for SQL execution, the SQL text is logged with sensitive literals redacted.

Requirements

  • Python 3.11+
  • AnalyticDB MySQL instance (MySQL-protocol–compatible)

Installation

From PyPI:

uv tool install analyticdb-mysql-cli

From local source:

cd analyticdb-mysql-cli
uv tool install .

After installation, the adbmysql-cli command is available. The same program is also installed as analyticdb-mysql-cli (e.g. for tooling that probes the binary name matching the PyPI package).

Connection

To connect to an AnalyticDB MySQL instance, create a global config file:

mkdir -p ~/.adbmysql
# Remote
echo 'ADBMYSQL_DSN="mysql://user:pass@host:port/database"' > ~/.adbmysql/config.env

Also supports --dsn CLI flag, ADBMYSQL_DSN environment variable, and project .env files, in decreasing priority.

Common commands

Command Description
adbmysql-cli status Connection status and version
adbmysql-cli schema tables List all tables
adbmysql-cli schema describe <table> Table structure (columns, types, indexes)
adbmysql-cli schema dump Output DDL for all tables (to stdout)
adbmysql-cli table profile <table> Table data profile (row count, nulls, distinct, min/max, candidate JOIN keys and time columns)
adbmysql-cli sql "<stmt>" Execute SQL (read-only by default; use --write for writes; --with-schema adds table schema; --no-truncate keeps large fields intact)
adbmysql-cli relations infer [--table <t>] Infer JOIN relationships between tables
adbmysql-cli ai-guide Print structured guide for AI agents (JSON)

Option order

--dsn and --format are global options and must appear before the subcommand:

adbmysql-cli --format table sql "SELECT * FROM t LIMIT 5"
adbmysql-cli --dsn "mysql://root:@127.0.0.1:3306/test" schema tables

Metadata

Release files for analyticdb-mysql-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for analyticdb-mysql-cli 0.1.0
File Size Uploaded Provenance
analyticdb_mysql_cli-0.1.0.tar.gz 22.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for analyticdb-mysql-cli 0.1.0
File Interpreter ABI Platform
analyticdb_mysql_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.5 kB

Release files / analyticdb_mysql_cli-0.1.0.tar.gz

Download URL analyticdb_mysql_cli-0.1.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cd92281cc2642a5d837d06ccb623f28c3e39e6c2d7aa86323ff05a1b5238f363
BLAKE2b-256 checksum
How to use checksums
8c5f49e09df831842b757689d47298fddf59284240fb70cba04283836bc72ddb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / analyticdb_mysql_cli-0.1.0-py3-none-any.whl

Download URL analyticdb_mysql_cli-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc1b331d52d046186f6a219e44827572a64d30338ce62be9c3eceaf8aaa50e6e
BLAKE2b-256 checksum
How to use checksums
2da47612e3b7f159ce737b95b3d15898f524d0d0a388a14f7a668622fcf7668f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Security for analyticdb-mysql-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page