Please Note:
This project is still in its early stages of development, and there’s a chance it may not function as expected on your machine at the moment. I'll be working on improvements, but consider this an experimental tool, and try to avoid any CREATE commands on a production database.
Additionally, be extremely cautious when using this code, as it generates and runs SQL queries directly on your database. Incorrect or unintended queries could modify or delete your data. It's essential to double-check the queries generated before execution.
Furthermore, to enable AI-driven query generation, portions of your database schema may be sent to OpenAI for processing. Ensure that no sensitive or private information is included in the schema before using the tool.
Only the schema is shared with openai models, not the data on your database(that is not shared). This is what makes it a cool project.
This is an exciting experiment, but please proceed carefully and with an understanding of the risks involved.
DataWise is an AI-powered BI tool that helps users interact with relational databases using plain language queries. It generates SQL queries automatically and displays the results in a user-friendly interface, without needing any SQL expertise. The backbone of this project is RAG
- Python 3.8+
pip(Python package manager)
Follow the steps below to set up and run the project locally.
git clone the-repo-url
cd datawiseIt's recommended to use a Python virtual environment to isolate dependencies.
python3 -m venv venvFor macOS/Linux:
source venv/bin/activateFor Windows:
.\venv\Scripts\activateInstall the necessary packages from the requirements.txt file.
pip install -r requirements.txtMake sure you configure the environment variables required for your database and API credentials. You can create a .env file in the project root with the following content:
OPENAI_KEY=your-openai-api-key
HOST=localhost
DB_USER=admin
PASSWORD=password
DATABASE=datawise-db2
PORT=3306Once the setup is complete, run the Streamlit app.
streamlit run app.pyAfter running the command, Streamlit will start the web app. Open the provided URL (e.g., http://localhost:8501) in your browser to access the tool.
- Convert plain language questions into SQL queries.
- Query relational databases without SQL knowledge.
- Visualize query results in a tabular format.
- Configure database connections and API keys in the settings.
This project is licensed under the MIT License.