Text to SQL - Simple way to generate the SQL in Flowtrail AI
Published: 2024-05-29 05:38:28

Keeping your business competitive today requires being able to extract insights from vast amounts of data quickly and efficiently. A significant barrier for many users is the need to know SQL and complex data visualization tools in order to query data or generate reports.

Flowtrail AI, an AI-powered reporting and analytics tool, is designed to democratize data access and analysis. In Flowtrail AI, users are able to generate complex SQL queries with the help of simple, natural language inputs, which makes it a standout feature.

This revolutionary feature empowers users of all skill levels to create and manipulate datasets with ease, revolutionizing how we interact with data and opening up the possibility of more intuitive and accessible analytics.

This blog explores how to create datasets using natural language with Flowtrail AI.

### Set up your data source

---

To get started, you can connect your database by filling out the correct details. Before saving, you can test the database to ensure it functions correctly and that it does not have any errors. We currently support MySQL, MsSQL, and PostgreSQL databases, with more options coming soon.

![datasource.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/datasource.png)

### Creating your datasets

---

Once you have successfully connected your data source, you can easily create your dataset using the intuitive user interface of Flowtrail AI.

1. **Choose your data source**: Navigate to the Datasets page. If you have multiple data sources saved, you can switch between them. Otherwise, the first data source will be selected.

![select-datasource.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/select-datasource.png)

2. **Write your query**: If you are an expert in SQL, you can write your query in the code editor. If you're not an expert in SQL, you can simply enter your prompt in the ASK AI section and hit enter. Our AI model will generate a query for you.

![datset-ai.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/datset-ai.png)

3. **Generate and execute the query**: The AI model generates an SQL query for you based on your text. Once the query has been generated, check if everything is OK. Once everything is correct, hit execute to see the results. See how easy it can be to visualize your data within minutes when you use our Text to SQL tool.

![dataset-screen.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/dataset-screen.png)

4. **Review query results**: The right side of the screen explains the query result. The executed script section describes the SQL query used to show the current result, which is helpful when you use parameters in your query.

![query-output.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/query-output.png)

5. **Output options**: The Data section shows the output in table format. The JSON tab shows the output in JSON format, and you also have the option to export the output to CSV and JSON.

![query-result.png](https://rxhr-devx-space.blr1.digitaloceanspaces.com/flowtrail-assets/blogs/text-sql/query-result.png)

Flowtrail AI supports dynamic parameterized dataset generation with various types of parameters like String, Integer, and Custom SQL. We will explore this feature in the next blog.

By harnessing the power of Flowtrail AI's Text to SQL feature, you can simplify your data operations and gain valuable insights faster than ever before. Stay tuned for more updates on how Flowtrail AI can transform your data analytics.

Get started: {% cta https://flowtrail.ai/ %} Flowtrail AI {% endcta %} 🚀

Join discord: https://discord.com/invite/fzqCPqnPGx