Skip to main content

Work with SQL

Learn how to use nao to write, execute, and manage SQL queries efficiently.

Browse your database​

Explore your connected data warehouse directly from nao.

  • Open the database side bar on the left to browse available tables.
  • When you click on a table, you will be able to preview it directly within nao.
Browse data

Run SQL queries​

You can directly execute SQL queries in .sql files.
Just click on the execute SQL button on the top bar, or press cmd+enter.

Multi-query execution:
  • If you have multiple SQL queries in a single file, nao will execute the query where your cursor is
  • You can also select a portion of SQL and execute this selection with cmd+enter
Execute SQL

SQL table/column completion​

For all data warehouses, nao will suggest auto-complete of tables and column names.
Every time you type "space", a dropdown with available tables/columns will appear.

nao AI autocomplete uses your data schema

Context of available tables/columns will also be passed to the AI auto-complete. This will allow the AI autocomplete to suggest SQL relevant to your underlying data.

Table suggestionColumn suggestionTab suggestions

Fix SQL with chat​

If you encounter error when executing SQL, a "fix in chat" button will appear. If you click on this button, the agent will be sent your query + error message, and suggest a fix to your SQL code.

Fix in chat

SQL worksheets​

You can create SQL worksheets within nao, for adhoc query writing.
These worksheets will be saved within nao, instead of being saved in your repository.

Create a worksheet

To create a worksheet, you can either click on the "+" button from an SQL file,
or go to the "worksheet" tab on the left panel.
From this panel, you will also be able to rename, delete, or open your worksheets.

SQL worksheets

SQL query costs (BigQuery)​

For BigQuery data warehouse, you can access the cost of your query in the bottom bar.
It will be available even before you run the SQL query, and will also indicate if the dry run of your query goes through.

BigQuery cost

Data changes preview​

When you change SQL code, nao allows you to preview directly corresponding changes in the data. Click on "table diff" in the preview section to see a highlighted version of additions / deletions in your data.

What is comparison point for the diff?

This table diff is based on the last commit of your branch.
It will show you data differences between running code in the last commit and current code of the file.

BigQuery cost