text2sql / README.md
Yash-dev-1744's picture
first commit
9998bc3
|
Raw
History Blame Contribute Delete
3.2 kB

A newer version of the Gradio SDK is available: 6.26.0

Upgrade
metadata
title: AI Database Query Assistant
emoji: πŸ€–
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 4.0.0
app_file: server.py
pinned: false

Warning: This project may not work due to Hugging Face restrictions. Please check out the GitHub repo for the latest updates.

πŸ€– AI Database Query Assistant

A powerful AI-powered database query assistant that allows you to interact with your MySQL database using natural language.

🏷️ Tags

  • agent-demo-track

✨ Features

Database Connection

  • Secure MySQL database connection with support for:
    • Custom host and port configuration
    • Username and password authentication
    • Special character support in passwords
    • Default port (3306) handling
    • Connection status monitoring

AI-Powered Query Processing

  • Natural language to SQL conversion using Google's Gemini model
  • Intelligent query validation and error handling
  • Automatic query correction and optimization
  • Support for complex SQL operations including:
    • Joins
    • Aggregations
    • Subqueries
    • Complex functions

Database Analysis

  • Comprehensive database structure analysis
  • Table schema visualization
  • Column information display
  • Primary and foreign key relationship mapping
  • Row count statistics

Query Features

  • Natural language question processing
  • SQL query generation and execution
  • Query performance metrics:
    • Execution time tracking
    • Row count statistics
    • Query complexity analysis
    • Performance insights

Query History

  • Track and store query history
  • View past queries with:
    • Timestamp
    • Original question
    • Generated SQL
    • Execution metrics
    • Complexity level
  • Reuse previous queries
  • Clear history functionality

Security Features

  • Secure password handling
  • SQL injection prevention
  • Query validation
  • API key management:
    • Environment variable support
    • User-provided key option
    • Secure key storage

User Interface

  • Modern Gradio-based interface
  • Tabbed navigation
  • Real-time status updates
  • Interactive query input
  • Formatted result display
  • Example questions for guidance

Performance Monitoring

  • Query execution time tracking
  • Complexity analysis
  • Performance insights
  • Resource usage optimization

Error Handling

  • Comprehensive error detection
  • User-friendly error messages
  • Automatic query correction
  • Detailed error reporting

πŸš€ Getting Started

  1. Install the required dependencies
  2. Set up your Google API key (for Gemini model)
  3. Configure your MySQL database connection
  4. Launch the application
  5. Start querying your database using natural language!

πŸ”§ Requirements

  • Python 3.x
  • MySQL database
  • Google API key for Gemini model
  • Required Python packages (see requirements.txt)

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.