Skip to main content

Analyzing Data Using Text-to-SQL Preview

This tutorial walks you through enabling and using Dremio's Text-to-SQL experience.

Dremio's Text-to-SQL experience allows you to effortlessly convert natural language queries into SQL directly within the SQL Runner. The Text-to-SQL translation is based on a semantic understanding of metadata and data, resulting in the industry’s most accurate SQL generation.

Prerequisites

Before you begin, sign up for Dremio Cloud and create your first project.

After you’ve signed up and created your first project, you can enable Generative AI features and try out Text-to-SQL!

Step 1. Enable the Generative AI Features

Opting into and enabling Generative AI provides you access to the Text-to-SQL experience, generated labels and wikis, and other features powered by Generative AI as they become available.

To enable Generative AI:

  1. Navigate to Project Settings > Preferences and toggle on Generative AI.
This is a screenshot showing how to enable Generative AI.
note

This feature set is in preview. It will allow this entire Sonar project and all users with access to the project to leverage Generative AI features. Note that these features have limited world knowledge and may occasionally generate incorrect information or produce harmful instructions or biased content. For more information, see Data Privacy.

Now you can analyze data using Text-to-SQL!

Step 2. Construct a Query Using Text-to-SQL

The Text-to-SQL experience processes natural language to produce SQL to analyze your one or more datasets.

To see this in action:

  1. Navigate to the SQL Runner by clicking This is the icon that represents the SQL runner. in the side navigation bar.

  2. Click in the toolbar.

This is a screenshot showing where Text-to-SQL is located in the SQL Runner.
  1. In the Data panel on the left, locate Samples."samples.dremio.com"."NYC-taxi-trips-iceberg". Drag and drop the table into the Datasets to analyze field.
This is a screenshot showing where to add datasets for Text-to-SQL.
  1. In the field labeled Type in a question or message, copy and paste the question below and click Generate.

    Sample question
    What's the average tip for a two-passenger ride?    
  2. SQL is generated for you, so all you have to do is click Run to get the answer!

This is a screenshot showing how to run Text-to-SQL.
tip

Try this out with multiple datasets! Add "SampleDB"."NYC-weather" to the datasets field in addition to NYC-taxi-trips-iceberg and input Give me the number of rides people took on the day that it rained the most..

Wrap-up and Next Steps

By just asking a question, you were able to analyze data in seconds without having to worry about which functions to use or having the right SQL syntax.

To try Text-to-SQL with your data, configure your own source!

To learn more about Dremio, check out Getting Started with Dremio.

Have Questions?

If you have questions about the concepts in this tutorial or other Dremio features, reach out to us using the chat feature This is the icon that represents the Intercom chat. in the bottom-right corner of the Dremio application.