Skip to main content

🚀 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

Quick Install (Recommended)

Install globally with pipx for the best experience:

pipx install moja-clickhouse-agent

Then run:

moja

This will start the interactive onboarding flow to configure your database and AI provider.

Manual 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

moja chat

Execute Single Query

moja query "SELECT * FROM my_table LIMIT 10"

Analyze Table

moja analyze my_table --deep

Load Data

moja 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

Metadata

Release files for moja-clickhouse-agent 1.0.4

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

Source distribution (sdist)

Source distribution for moja-clickhouse-agent 1.0.4
File Size Uploaded
moja_clickhouse_agent-1.0.4.tar.gz 40.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moja-clickhouse-agent 1.0.4
File Interpreter ABI Platform
moja_clickhouse_agent-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 84.4 kB

Release files / moja_clickhouse_agent-1.0.4.tar.gz

Download URL moja_clickhouse_agent-1.0.4.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
561cb993542a3d78ab8b3301232ed978c9f5ec8d55966e996c97650465e9f15b
BLAKE2b-256 checksum
How to use checksums
98689764790d63778259b738ef624976dfa8196fbe00c428ecd8ec107aa2c235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / moja_clickhouse_agent-1.0.4-py3-none-any.whl

Download URL moja_clickhouse_agent-1.0.4-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba390b55a6e4350fdb9646e18c63bfa21c1b121b52a97ff37547a8af3c579415
BLAKE2b-256 checksum
How to use checksums
58628950cbcee090d05dbe7da297fe3bdb861e1bb8f9967544c0fd6b56b178b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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