Skip to main content

🚀 ClickHouse AI Agent - Intelligent database analysis and operations

Project description

🚀 Moja - ClickHouse AI Agent

A beautiful, intelligent CLI agent for ClickHouse database analysis and operations.

✨ Features

  • 🤖 AI-Powered: Intelligent natural language interface for ClickHouse operations
  • 📊 Data Analysis: Comprehensive table analysis with statistics and insights
  • 📈 Visualizations: Create beautiful charts and graphs from query results
  • 📥 Data Loading: Load CSV, JSON files into ClickHouse with auto-schema detection
  • 📤 Data Export: Export query results to various formats (CSV, JSON, Parquet, Excel)
  • 🔧 Database Management: Table optimization, system information, and more
  • 🎨 Beautiful CLI: Rich, colorful interface with progress bars and tables

🛠️ Installation

# Clone the repository
git clone https://github.com/vish/moja.git
cd moja

# Install dependencies
pip install -r requirements.txt

# Set up your configuration
export OPENROUTER_API_KEY="your-api-key"
export CLICKHOUSE_HOST="localhost"
export CLICKHOUSE_PORT="8123"

🚀 Quick Start

Interactive Chat Mode

python main.py chat

Execute Single Query

python main.py query "SELECT * FROM my_table LIMIT 10"

Analyze Table

python main.py analyze my_table --deep

Load Data

python main.py load-data data.csv my_table

🔧 Configuration

Create a .env file or use environment variables:

# ClickHouse Configuration
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USERNAME=default
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=default

# OpenRouter Configuration
OPENROUTER_API_KEY=your-api-key-here
OPENROUTER_MODEL=openai/gpt-4o-mini

🤖 AI Capabilities

Moja understands natural language commands like:

  • "Show me all tables in the database"
  • "Analyze the user_events table and find patterns"
  • "Create a bar chart showing sales by month"
  • "Load the CSV file into a new table"
  • "Export the query results to Excel"

🏗️ Architecture

Built with modern Python tools:

  • Typer: Beautiful CLI interface
  • Rich: Colorful terminal output
  • ClickHouse Connect: Fast database connectivity
  • OpenRouter: AI model access
  • Plotly: Interactive visualizations
  • Pandas: Data manipulation

📖 Examples

Data Analysis

# Interactive session
python main.py chat

> "Analyze my sales_data table and show me the top products"
> "Create a line chart showing revenue trends over time"
> "Find any anomalies in the user behavior data"

Batch Operations

# Load multiple files
python main.py load-data sales_2023.csv sales_data
python main.py load-data users.json user_profiles

# Analyze and export
python main.py analyze sales_data --deep
python main.py query "SELECT * FROM sales_data WHERE revenue > 1000" --format csv --save results.csv

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see LICENSE file for details.


Built with ❤️ for the ClickHouse community

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

moja_clickhouse_agent-1.0.1.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

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

moja_clickhouse_agent-1.0.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file moja_clickhouse_agent-1.0.1.tar.gz.

File metadata

  • Download URL: moja_clickhouse_agent-1.0.1.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moja_clickhouse_agent-1.0.1.tar.gz
Algorithm Hash digest
SHA256 afd985ace6b6edb8b9e2bc1abdc456d1257bf7ac1ea1f5fd9a4cef01c186a477
MD5 eb0ec6f132089467e08ffecb0658c06e
BLAKE2b-256 8350a1ba05d5870a5e502f491d19af7787ac1ccc2feaecaf94f4d78e241198d7

See more details on using hashes here.

File details

Details for the file moja_clickhouse_agent-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for moja_clickhouse_agent-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe96a14b950fd22b07beb9b0c56cd4baa7cdfbbb8d5b90e1bb520aaf45b9af3d
MD5 16b114cd8cfc49f0d103cb69ed2d1993
BLAKE2b-256 b8c318e781e91bcf0922159cca2b7a8bec80ceb0dc16b2373664c1b5b05e3c53

See more details on using hashes here.

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