This plugin allows you to query data by asking questions in Human-language without the need to know SQL language.
- A Grafana datasource plugin that translates "human" queries into SQL queries
- A microservice using OpenAI to translate a question into a SQL query based on a description of the data in the database (repository)
To use OpenAI services, you need an API key. Here are the steps to create an OpenAI token:
-
Refer to OpenAI Documentation: Follow the official OpenAI documentation to create your API key. You can find detailed instructions on how to obtain your key in the OpenAI Documentation.
-
Update Environment Variables: Once you have your API key, create or modify your
.env
file and add the following line:OPENAPI_KEY_API=your-openai-api-key
Replace
your-openai-api-key
with the actual API key you obtained from OpenAI.
- Install docker-compose from here
- Run the command
make build
to build datasource backend and frontend - Run the command
make start
to run grafana / mysql / fetchMate dockers - Access Grafana at
localhost:3000
- Log in using the ID
admin
and passwordadmin
- Navigate to the "Explore" module in Grafana
- Open a datasource "Basket dataset" or "Product dataset"
- Ask your questions. Examples with the "Basket" dataset:
- Provide the average daily basket cost for the 'Family Foods' store by day
- What day had the highest revenue for 'Family Foods' store?
- Which customer (name) buys the most products?
To configure a new datasource:
- Create a MySQL datasource
- Create a "FetchMate" type datasource
- Enter the URL of the FetchMate service
- Specify the SQL data source to use
- Click the "Auto prefill" button to prefill tables descriptions
- Provide information about table contents, fields, and how they are related
- Test! The accuracy of responses depends greatly on the quality of table and column descriptions. It's ideal to update information based on the quality of responses provided by the AI.
We welcome contributions from the community. If you'd like to contribute, please follow these steps:
- Fork the repository on GitHub.
- Clone your forked repository to your local machine.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with a clear message.
- Push your changes to your fork on GitHub.
- Open a pull request from your branch to the main repository's
master
branch. - Be sure to describe your changes in detail and explain why they are necessary.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.