bunnysql

Crates.iobunnysql
lib.rsbunnysql
version0.2.1
created_at2025-07-11 09:53:16.998631+00
updated_at2025-07-14 13:00:20.643032+00
description๐Ÿฐ Bunny SQL Assistant is a CLI tool that converts natural language into SQL.
homepagehttps://github.com/albanysiswanto/bunny-sql-assistant.git
repositoryhttps://github.com/albanysiswanto/bunny-sql-assistant.git
max_upload_size
id1747599
size97,659
Albany Siswanto (albanysiswanto)

documentation

README

๐Ÿฐ Bunny SQL Assistant

Bunny SQL Assistant is a command-line interface (CLI) tool that transforms natural language commands (in Indonesian or English) into valid SQL queries and executes them directly on your local database. This project is designed to simplify database interactions using everyday language.


โœจ Key Features

  • Natural Language Conversion: Transform natural language commands into valid SQL queries
  • Multi-Database Support: Works with both SQLite and PostgreSQL
  • AI Integration: Powered by the Groq API for intelligent language processing
  • Direct Execution: Run SQL queries directly on your local database
  • Secure Configuration: Store database connection details securely using configuration files
  • Rich Output Formatting: Beautifully formatted table outputs for query results

โš™๏ธ Installation

Prerequisites

Before you begin, ensure you have installed:

Installation Steps

  1. Clone the Repository:

    git clone https://github.com/yourusername/bunny-sql-assistant.git
    cd bunny-sql-assistant
    
  2. Build the Project:

    cargo build --release
    
  3. Verify Installation: Ensure the bunny binary is available in the ./target/release/ directory.


๐Ÿš€ Usage

1. Configure the Database Connection

For SQLite:

bunnysql config --db-type sqlite sqlite://database_file.db

Example:

bunnysql config --db-type sqlite sqlite://test.db

For PostgreSQL:

bunnysql config --db-type postgres postgres://username:password@localhost:5432/database_name

Example:

bunnysql config --db-type postgres postgres://postgres:bunny@localhost:5432/mydb

Note: Database files will be created automatically for SQLite. For PostgreSQL, ensure the database exists.

2. Run Queries with Natural Language

Basic query format:

bunnysql query "Your natural language query"

SQLite Examples:

bunnysql query "Show all products"
bunnysql query "Find users older than 25 years"

PostgreSQL Examples:

bunnysql query "Show top 5 customers by total purchases"
bunnysql query "List all orders from last month"

3. Get Help

bunnysql --help

๐Ÿง  AI Model Configuration

Configure the Groq API by creating a .env file:

GROQ_API_KEY=your_api_key_here
GROQ_MODEL=mixtral-8x7b-32768  # or other supported models

Supported Models:

  • llama3-8b-8192
  • mixtral-8x7b-32768
  • Other models available at Groq API

๐Ÿงช Development

For SQLite Development:

cargo install sqlx-cli --no-default-features --features sqlite
DATABASE_URL=sqlite://test.db cargo sqlx prepare

For PostgreSQL Development:

cargo install sqlx-cli --no-default-features --features postgres
DATABASE_URL=postgres://user:pass@localhost:5432/db cargo sqlx prepare

โš ๏ธ Limitations

  • Supported Databases:
    • SQLite
    • PostgreSQL
  • Query Complexity: Very complex queries may require manual refinement
  • Connection Limits: Ensure your PostgreSQL server allows connections

๐Ÿ“„ License

MIT License ยฉ 2025 Albany Siswanto


๐Ÿ‡ Contribution

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

Report issues on our GitHub Issues page.


๐Ÿ“ฌ Contact

For questions or support:


Thank you for using Bunny SQL Assistant! ๐Ÿฐ

Commit count: 0

cargo fmt