DEV Community

Cover image for Introducing Chat2Query: An Innovative AI-Powered SQL Generator for Faster Insights
TiDB Community
TiDB Community

Posted on

Introducing Chat2Query: An Innovative AI-Powered SQL Generator for Faster Insights

We are excited to introduce Chat2Query (beta), a revolutionary natural language query generator powered by Pre-trained Transformer 3 (GPT-3), the technology behind ChatGPT, and TiDB, the distributed SQL database.

With Chat2Query, you don’t need to be an SQL expert to extract insights from your data. Simply ask a question and the AI tool will do the rest, generating a powerful SQL query to retrieve the insights. By combining OpenAI and TiDB, we utilize AI to innovate the database and aid in data exploration, providing real-time and actionable insights for instant business decisions.

In this post, we’ll show you how to get started with the AI-powered Chat2Query and explore insights through sample datasets and your own datasets.

More than just another AI-powered SQL generator

Yes, there are several AI-powered SQL generators available that can help users generate SQL queries without needing to have extensive knowledge of the SQL language. However, these AI tools are best suited for generating simple queries. This means they may not be suitable for more complex tasks or production use.

Chat2Query is powered by:

  • OpenAI’s GPT3, the industry-leading natural language-to-code processing model and the technology behind the viral ChatGPT.

  • TiDB Cloud Serverless Tier, the Hybrid Transactional and Analytical Processing (HTAP) database service that enables developers to deploy their infrastructure at scale in the most cost-efficient way without managing server infrastructure.

By using these two technologies, Chat2Query can handle even the most complex queries and offer real-time insights into dynamic datasets.

Query on the Netflix dataset – tell me the best 10 Netflix titles.

Image description

Query on a Web3 dataset – in which month of last year did the highest volumehappen?

Image description

Get started with Chat2Query

Chat2Query is an integrated feature in TiDB Cloud Serverless Tier. You can take the following steps to get started:

Step 1: Sign in to your Serverless Tier cluster.

Sign up for a TiDB Cloud account using your email, Google account, or GitHub account. Your Serverless Tier cluster will be created automatically in less than 20 seconds, and you will be directed to the Chat2Query interface.

Step 2: Prepare your datasets.

You can either use the sample datasets to quickly explore Chat2Query or explore insights on your own datasets.

Image description

Image description

Step 3: Explore insights with Chat2Query.

  1. Generate the query. In the Chat2Query editor, type in “– your question” and click Enter to let AI generates the query in SQL.
  2. Review the query. Press the Tab key to accept the SQL or edit it as necessary before accepting.
  3. Run your query. In the top right-hand corner of the screen, click the play button. The query results are displayed at the bottom of the page.
    You will see the query logs and results immediately at the bottom of the page. For sample output, see Exploring sample uses.

    Built with security and privacy

    The privacy and security of user data is our top priority. We understand that our users trust us to protect their information and we take that responsibility seriously. As a query service on TiDB Cloud, Chat2Query only needs to access your database schema to generate SQL, and not your actual data.

    Limitations

    As a beta project, Chat2Query is still in development with a lot of room for improvement. Therefore, there are two limitations to keep in mind:

  4. The AI-generated SQL is not always 100% correct and may still need further tweaking.

  5. Chat2Query has limited support for SQL statements. DDL statements such as

CREATE TABLE
Enter fullscreen mode Exit fullscreen mode

and

DROP TABLE
Enter fullscreen mode Exit fullscreen mode

are not supported yet.

Get started withChat2Querytoday

You can obtain early access here. We’d love to hear your feedback so we can make this query tool even better.

In the meantime, Chat2Query is in rapid development. Please follow us on Twitter to stay up-to-date on its progress.

Top comments (2)

Collapse
 
damir_budanec_3124983bc34 profile image
Damir Budanec

The fact that there is not even one comment on this page is absolutely crazy to me. This is an amazing tool. I will post my results here if there are people interested

Collapse
 
tidbcommunity profile image
TiDB Community

Hi Damir, we're glad to hear you're finding the tool amazing. Please feel free to share your results here—I'm sure many people would be interested! Looking forward to hearing more from you!