Skip to main content

AI-powered CLI tool for Relation database management and analysis

Project description

RDSAI CLI

AI-Powered Database Command-Line Interface

Python 3.13+ License GitHub issues

English | 中文

RDSAI CLI Screenshot

RDSAI CLI is an AI-powered command-line interface for database management.
It supports natural language queries and SQL execution, with built-in diagnostic tools,
execution plan analysis, and multi-source data connections.


Features

  • Multi-Source Connection - Connect to MySQL databases or files (CSV, Excel) locally or remotely via HTTP/HTTPS
  • AI Assistant - Natural language queries (English/Chinese), SQL optimization, diagnostics, and explanations
  • Smart SQL - Auto-detects SQL vs natural language, query history, Ctrl+E for instant result explanations
  • Multi-Model LLM - Support for Qwen, OpenAI, DeepSeek, Anthropic, Gemini, and OpenAI-compatible APIs
  • Schema Analysis - AI-powered database analysis with compliance checking and optimization suggestions
  • Performance Benchmarking - Automated sysbench testing with comprehensive analysis reports
  • MCP Integration - Extend capabilities via Model Context Protocol servers
  • Safety First - Read-only by default, DDL/DML requires confirmation (YOLO mode available)

Requirements

  • Python 3.13+
  • Network access to MySQL
  • API access to LLM provider

Installation

# One-click installation (recommended)
curl -LsSf https://raw.githubusercontent.com/aliyun/rdsai-cli/main/install.sh | sh

# Or using uv
uv tool install --python 3.13 rdsai-cli

# Or using pip (recommend virtual environment)
pip install rdsai-cli

Quick Start

Launch and Connect

# Start without connection (interactive mode)
rdsai

# Connect via command line
rdsai --host localhost -u root -p secret -D mydb

# Connect to files
rdsai
> /connect flights.csv
> /connect https://example.com/data.csv

Configure LLM

mysql> /setup

Interactive wizard will guide you through LLM provider setup. Configuration is saved to ~/.rdsai-cli/config.json.

Basic Usage

SQL Execution:

mysql> SELECT COUNT(*) FROM users;
mysql> EXPLAIN SELECT * FROM users WHERE email = 'test@example.com';
mysql> SELECT * FROM users LIMIT 10\G   -- Press Ctrl+E for AI explanation

Natural Language:

mysql> analyze index usage on users table
mysql> show me slow queries from the last hour
mysql> design an orders table for e-commerce
mysql> why this query is slow: SELECT * FROM users WHERE name LIKE '%john%'

Meta Commands

Command Description
/connect, /disconnect Connect/disconnect from database or files
/setup Configure LLM provider
/help Show help and status
/explain Analyze SQL execution plan
/research Generate database schema analysis report
/benchmark Run performance benchmark test
/yolo Toggle auto-approve mode (use with caution)
/history Show query history
/model Manage LLM models

Documentation

  • Complete Tutorial - Comprehensive guide from beginner to advanced
  • Core Features - Execution plan analysis, schema analysis, benchmarking, MCP integration
  • Usage Scenarios - SQL explanation, file analysis, slow query optimization, and more

Security

  • Read-Only by Default - DDL/DML require explicit confirmation unless YOLO mode is enabled
  • Confirmation Required - Every write operation shows exact SQL for review before execution
  • Credential Storage - API keys stored in ~/.rdsai-cli/config.json (protect with proper permissions)

Contributing

We welcome contributions. See CONTRIBUTING.md for details.

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rdsai_cli-0.1.9.tar.gz (780.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rdsai_cli-0.1.9-py3-none-any.whl (880.7 kB view details)

Uploaded Python 3

File details

Details for the file rdsai_cli-0.1.9.tar.gz.

File metadata

  • Download URL: rdsai_cli-0.1.9.tar.gz
  • Upload date:
  • Size: 780.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rdsai_cli-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ef13e99ab290f46af8230812d73cc14c4de503fa5e61955d646786b1165c712a
MD5 39e8fc295cf7e22233c464ea7f87c429
BLAKE2b-256 070f55838fa2f8212f049bd9c2fe3bb5fc7a875d6f4997d7b6c8b8850e23c698

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdsai_cli-0.1.9.tar.gz:

Publisher: python-publish.yml on aliyun/rdsai-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdsai_cli-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: rdsai_cli-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 880.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rdsai_cli-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 34c9054c48ab2bbddc69b682acc2d33d64970ae2235cc78d60151eb53ce8f654
MD5 e9eeb67793ea60ecd004deedcc3dcf2c
BLAKE2b-256 f33ee5015477d5b7fb6d5f2c11773b679254a2b80238ebb7ee41daccf6df1a01

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdsai_cli-0.1.9-py3-none-any.whl:

Publisher: python-publish.yml on aliyun/rdsai-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page