MQL (My Query Language) is a powerful tool to transform natural language queries into executable SQL queries. What's cool is that anyone can use it, even without knowing how to code. Just add your database by connecting or uploading schema to MQL, ask a query in your language and get the SQL.
Make sure you have docker installed.
To begin, clone this Git repository:
git clone https://github.com/shurutech/mqlUpdate server/Dockerfile with your OPENAI_API_KEY key:
ENV OPENAI_API_KEY YOUR_TOKEN_HERE
Update the DATABASE_URL in the server/.env file according to the following rules:
Navigate to the repository folder and run the following command:
make install
Once the installation is complete, you can access the MQL dashboard at: http://localhost:3000
If needed, you can also restart to reflect local changes, if any, using:
make restart
Also, you can terminate the local setup using:
make down
Also, you can start up all the containers using:
make up
A default user is created for login purpose while running the tool using docker.
Take care of below steps if you are looking to make it Live
As of the current version, MQL is designed to work exclusively with PostgreSQL.
These are the required packages which needs to be installed to run the project locally.
Python
psycopg2
Node
PostgreSQL 15
pgvector extension for PostgreSQL - pgvector
Run these commands in your PostgreSQL command line client
Creating the PostgreSQL Role
Create a PostgreSQL role with superuser permissions and login capability:
CREATE ROLE <role_name> WITH superuser;
ALTER ROLE <role_name> WITH LOGIN PASSWORD 'password';Creating the Databases
Create two databases, mql and mql_test, with the shuru role:
CREATE DATABASE mql WITH OWNER <role_name>;
CREATE DATABASE mql_test WITH OWNER <role_name>;Creating the Extension
To create the vector extension:
Connect with the database using:
c <databse_name>Create the vector extension:
CREATE EXTENSION vector;Update these values at server/.env
DATABASE_URL="postgresql://<role_name>:<password>@<host>:5432/mql"
TEST_DATABASE_URL="postgresql://<role_name>:<password>@<host>:5432/mql_test"
OPENAI_API_KEY="<key>"If database is locally hosted then host will be localhost
Navigate to the repository folder and run the command in terminal
chmod +x ./setup.sh && ./setup.shOnce the installation is complete, you can access the MQL dashboard at: http://localhost:3000
Our testing process involved running 50 natural language queries through the MQL platform, with resources like a elearning_schema file, and a CSV of query mappings located in our test_data folder. The MQL achieved around 85% success rate, accurately translating 43 out of 50 queries. However, when considering the precision of the translations, about 74% (37 out of 50) of the queries were executed perfectly, with 6 queries correctly interpreted but missing a semi-colon at the end. This left us with 7 queries that resulted in errors. We're actively working on enhancements to improve both the accuracy and the completeness of the SQL syntax generation, and we welcome contributions to help refine our platform.
We plan to continue building after the initial release and look forward to the feedback from the community. As of now we have following features planned out for next releases.
We value the contributions of each developer and encourage you to share your ideas, improvements, and fixes with us. To ensure a smooth collaboration process, please follow these guidelines.
Before you begin:
Reporting Bugs
Before reporting a bug, please:
Suggesting Enhancements We love to receive suggestions for enhancements! Please:
Pull Requests Ready to contribute code? Follow these steps:
Conduct We are committed to providing a welcoming and inspiring community for all. By participating in this project, you are expected to uphold our Code of Conduct, which promotes respect and collaboration.