https://github.com/shurutech/mql Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} shurutech / mql Public * Notifications * Fork 2 * Star 67 * MQL tool is designed to generate SQL queries directly from natural language inputs. shurutech.com/mql-sql-from-natural-language-with-85-accuracy/ License MIT license 67 stars 2 forks Branches Tags Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights shurutech/mql This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 70 Commits client client server server storage storage test_data test_data .gitignore .gitignore CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md LICENSE LICENSE Makefile Makefile README.md README.md docker-compose.yml docker-compose.yml setup.sh setup.sh View all files Repository files navigation * README * Code of conduct * MIT license MQL 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. MQL_Query_Demo.mp4 Getting Started MQL_GetStarted.mp4 Run the tool locally using Docker. * Make sure you have docker installed. * To begin, clone this Git repository: git clone https://github.com/shurutech/mql * Update server/Dockerfile with your OPENAI_API_KEY key: ENV OPENAI_API_KEY YOUR_TOKEN_HERE * 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 the local setup using: make restart Also, you can terminate the local setup using: make down Use Default Email/Password for Login to Test MQL A default user is created for login purpose while running the tool using docker. * Email - admin@example.com * Password - admin Want to Productionize MQL? Take care of below steps if you are looking to make it Live * Delete default user: To delete default user(admin@example.com), you need to connect with mql database(mql-postgres) and then remove it from users table. * Create a new user: + go to project's root directory + exec in backend docker container: docker-compose exec backend /bin/bash + run create_user script: python3 scripts/create_user.py + enter email, password and name to create your own user Supported Databases As of the current version, MQL is designed to work exclusively with PostgreSQL. --------------------------------------------------------------------- You can also run the tool locally without Docker. * Prerequisites These are the required packages which needs to be installed to run the project locally. 1. Python 2. psycopg2 3. Node 4. PostgreSQL 15 5. pgvector extension for PostgreSQL - pgvector * Database Setup Run these commands in your PostgreSQL command line client 1. Creating the PostgreSQL Role Create a PostgreSQL role with superuser permissions and login capability: CREATE ROLE WITH superuser; ALTER ROLE WITH LOGIN PASSWORD 'password'; 2. Creating the Databases Create two databases, analytics and analytics_test, with the shuru role: CREATE DATABASE analytics WITH OWNER ; CREATE DATABASE analytics_test WITH OWNER ; 3. Creating the Extension To create the vector extension: * Connect with the database using: \c * Create the vector extension: CREATE EXTENSION vector; * Update your env Update these values at server/.env DATABASE_URL="postgresql://:@:5432/analytics" TEST_DATABASE_URL="postgresql://:@:5432/analytics_test" OPENAI_API_KEY="" If database is locally hosted then host will be localhost * Run the Script Navigate to the repository folder and run the command in terminal chmod +x ./setup.sh && ./setup.sh Once the installation is complete, you can access the MQL dashboard at: http://localhost:3000 Accuracy Test Score 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 have taken database set from here for testing purpose. * You can remove test_data folder after checking it. Next Steps/Features 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. * Implementation of query execution * Improve directly connected dbs and SQL query results * Support for MySQL database * Improvements in Query Accuracy * Show natural language response and data visualisation. * User can integrate slack or similar apps to get NL query result there. * Test retool to generate the queries. Contribution Guidelines 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: * Make sure you have a GitHub account. * Familiarize yourself with the project by reading the README, exploring the issues, and understanding the tool's architecture and coding standards. How to Contribute Reporting Bugs Before reporting a bug, please: * Check the issue tracker to ensure the bug hasn't already been reported. * If the issue is unreported, create a new issue, providing: + A clear title and description. + Steps to reproduce the bug. + Expected behavior and what actually happened. + Any relevant error messages or screenshots. Suggesting Enhancements We love to receive suggestions for enhancements! Please: * First, check if the enhancement has already been suggested. * If not, open a new issue, describing the enhancement and why it would be beneficial. Pull Requests Ready to contribute code? Follow these steps: 1. Fork the repository - Create your own fork of the project. 2. Create a new branch for your changes - Keep your branch focused on a single feature or bug fix. 3. Commit your changes - Write clear, concise commit messages that explain your changes. 4. Follow the coding standards - Ensure your code adheres to the coding standards used throughout the project. 5. Write tests - If possible, write tests to cover the new functionality or bug fix. 6. Submit a pull request - Provide a clear description of the problem and solution. Include the relevant issue number if applicable. 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. About MQL tool is designed to generate SQL queries directly from natural language inputs. shurutech.com/mql-sql-from-natural-language-with-85-accuracy/ Topics database sql-query analytics-tool generative-ai Resources Readme License MIT license Code of conduct Code of conduct Activity Custom properties Stars 67 stars Watchers 0 watching Forks 2 forks Report repository Releases 1 First release Latest Apr 2, 2024 Packages 0 No packages published Contributors 4 * @ashok-shuru ashok-shuru * @vijay-shuru vijay-shuru * @mayank-shuru mayank-shuru Mayank Shakya * @kshitijb kshitijb Kshitij Bhardwaj Languages * Python 63.2% * TypeScript 31.8% * JavaScript 1.8% * Shell 1.0% * Makefile 0.8% * Dockerfile 0.7% * Other 0.7% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.