The AI SQL Query Assistant is a powerful tool that enables users to interact with databases using natural language queries. This project combines a React frontend for a smooth user interface with a FastAPI backend for robust query processing.
- Features
- Prerequisities
- Installation
- Running the Application
- Project Structure
- Usage
- Contact Page
- Deployment
- Natural language to SQL query conversion
- Interactive user interface for query input and results display
- Real-time query execution and response
- Python 3.7+
- Node.js (version 14 or later recommended)
- npm (Node Package Manager)
- pip (Python Package Installer)
-
Clone the repository:
git clone https://github.com/Smart-Solvers/SQL-Query-Assistant.git cd SQL-Query-Assistant
-
Set up the backend:
cd backend pip install -r requirements.txt
-
Set up the frontend:
cd ../frontend npm install
To host the FastAPI endpoint on your localhost:
-
Navigate to the backend directory:
cd backend
-
Start the FASTAPI server:
uvicorn main:app --reload
The backend will be available at http://localhost:8000.
To run the React application and connect it to the FastAPI endpoint:
-
In a new terminal, navigate to the frontend directory:
cd frontend
-
Start the React development server:
npm start
The application will open in your default browser at http://localhost:3000
SQL-Query-Assistant/
├── backend/
│ ├── main.py # FastAPI main application
│ ├── requirements.txt # Python dependencies
│ └── ... # Other backend files and directories
├── frontend/
│ ├── src/
│ │ ├── App.js # Main React component
│ │ ├── index.js # Entry point for the React application
| | |__ components/ # React components
│ │ └── ... # Other React components and files
│ ├── public/
│ └── package.json # Node.js dependencies and scripts
└── README.md # Project documentation
- Ensure both the backend and frontend servers are running as described in the "Running the Application" section.
- Open your web browser and navigate to http://localhost:3000
The main interface consists of several components:
- Home Page
- Login Page
- About Page
- Contact Page
- In Home page Click on Get started, You will be redirected to the Login page
- User need to login with the username, host, password
- After login , the page will redirect to the Query Interface
The Query interface consists of several key components:
- Database selection dropdown (if multiple databases are supported)
- Query input field
- Submit button
- Results display area
- History panel (for viewing past queries)
- select the target database from the dropdown menu.
- In the main input field, type your question or request in natural language.
For example:
"Show me all the tables in the database"
"What were the total sales in Q1 of 2023?"
"List the top 5 products by revenue"
- Click the "Send" button or press Enter to process your query.
- The application will display a loading indicator while processing.
- Once processed, the application will show you the SQL query generated from your natural language input and the result of the query
- You can copy the sql query
- You can download the results in the form of json file into your local, by clicking the download button
- Your past queries are saved in the history panel.
- Click on the chat, the history will be restored
- you can also delete the query history by clicking the delete button next to the chat
- you can logout once you are done
- Here you can give your feedback or any other information you would to dicuss with us
- Enter your name, email and the information and click on submit
- It will automatically sent the email to our mail_id
- In response you will receive a automatically generated email from our email
The AI SQL Query Assistant is now deployed and accessible online.
The application is deployed and can be accessed at: https://trial-backend-deploy.vercel.app/
When you visit this URL, you'll be presented with a user-friendly interface featuring:
- Home page
- About page
- Contact page
- FAQ page
To use the AI SQL Query Assistant:
- Navigate to the Home page
- Click on "Get Started" to access the login page
- Use the following credentials to log in:
Field | Value |
---|---|
Host | roundhouse.proxy.rlwy.net |
Username | root |
Password | VKwsbjfDIiHCbPGBLjGrSsrAkagWcjth |
These credentials connect to a database hosted on Railway.app, allowing for global access to a sample database for demonstration purposes.
- Frontend: The React frontend is deployed on Vercel, providing fast and reliable static hosting.
- Backend: The FastAPI backend is deployed on Render, utilizing serverless functions for efficient scaling.
- Database: We use a MYSQL database hosted on Railway.app for the deployed version. This ensures reliable and scalable database access.