HeavyIQ SQL Notebook
Last updated
Last updated
With HEAVY V8, we announce HeavyIQ, our new AI supercharged Conversational Analytics capability. HeavyIQ allows you to utilize natural language to access your data and find insights. HeavyIQ is accessed via SQL Notebook.
SQL Notebook is our new version of SQL Editor allowing you to interact with your data via natural language or using HeavySQL, whatever you are most comfortable with! Whichever way you ask questions, you will get results via some combination of tabular data, natural language, and data visualizations that we think will give you the most insight into your data.
Click the SQL Notebook icon in the lefthand navigation menu to get started.
There are two main ways to ask questions in SQL Notebook:
The first is by asking a natural language question about your data. Simply type in the input and click "Generate".
The second is to write SQL. Start typing SQL or manually toggle the SQL Editor toggle to start writing SQL and click "Run" to run your query.
After asking a question in one of those two ways, you will get a result cell.
From here you can edit the SQL and navigate the tabs at the bottom to view the "Details" table, "Summary" natural language response, or "Visualizations" that have been generated for your query.
A natural language summary is only available when a natural language question has been asked. SQL Queries will return only table "Details" and "Visualizations".
On the left hand side of the screen there is a database browser. From here you can explore a database's tables, a table's columns, and easily insert either of these into your active input.
To paste a table name into your input, hover over the item and click the blue arrow to paste.
To view the columns in that table, click the name of the table. From here you can search and filter column names, and use the same blue arrow to paste into your active input.
The blue arrow to insert a table or column name will be disabled if you do not have an active SQL editor. This can happen if you only have a natural language input open. Click the SQL Editor toggle to enable these buttons.
Ask a question and click "Generate" to start getting familiar with SQL Notebook. HeavyIQ will choose tables, generate a SQL query, and display the best answer it can come up with! In this case it chooses a line chart of observations over time.
The most powerful feature of the SQL Notebook is that you can interact with your data via prompt and get a SQL query, table results, natural language answer, and visualizations. Just start typing into the input to ask a question.
Skip ahead to Getting Answers to get details on getting the most out of the different result types (SQL, table, NL answer, visualizations)
Generate a histogram showing the number of tweets per state.
What are the top 5 users with the most tweets?
Show a histogram of total BOE production per well in bins of 100000 for wells with less than 2M total BOE.
Rank users by number of tweets from the most tweets to the least tweets.
Show the location of all tweets that mention fungi, do not count tweets from users with less than 100 total tweets.
SQL Notebook allows you to select datasources that you want to ask a question of, or not. If no datasources are selected HeavyIQ will find the most relevant sources, and generate a query from those tables.
Click the "+ Add" button to select specific datasources
Search for and select datasources, then click "Add Sources"
Selected sources appear at the bottom of the input and can be removed by clicking the "x"
To edit a previously asked question, click on the question you asked.
The generated SQL is editable, so click into the text box and start editing. You can use Shift+Enter
, Cmd+Enter
, or Ctrl+Enter
to submit your query again or click the "Run" button at the bottom of the cell.
There are two ways to enter SQL Editor mode when entering input:
Click the toggle at the bottom of the input or the button in the input placeholder to manually enter SQL Editor mode.
Start typing or paste a SQL statement and the editor will flip automatically to SQL Editor mode.
Sometimes you need to format SQL you've typed or want to collapse your SQL to a single line. Click on "Format SQL" to pretty print your SQL, and click Single Line to collapse your SQL onto a single line.
The format and single line options are on the righthand side when you are viewing an analysis result.
If your SQL is longer and you want more lines in your editor, use the expand/collapse functionality to view more or less of your code.
After asking a question, you have a few options on how to digest the results. There are three main sections to choose from:
After running a SQL query it's easy to see a tabular view of your data by viewing the "Details" tab to view a table of your results
Queries will be automatically capped at 5,000 rows for most visualizations. For pointmap visualizations that limit is 5,000,000.
The Summary tab will provide a natural language response to a natural language question.
If the answer to your question is too long, you will not have the option to view the "Summary". The "Details" and "Visualizations" tabs most likely hold a better answer to your question in these cases.
To view visualizations that were generated for your query, use the "Visualization" tab at the bottom of the cell.
Visualization options will be presented as an icon in the upper right of the cell result. Swap between visualizations by clicking the icons. You can then customize your generated chart once it's been selected.
Examples:
Once a chart is selected you can customize which fields are used for which measures in the chart, as well as other options. Below is an example of the scatterplot options:
There is a dropdown per field associated axes on the chart. Click and select another field to change.
Fields can also be set in the same way to determine color and size among other things.
If you don't want to use a field for color, size, etc click the toggle next to the field to turn it off.
The data limit slider controls how many rows to use in the visualization.
Some settings can be binned in the visualizations without having to update the query. To enable, toggle the "Binning" switch on and select the number of bins you would like to see.
There are a couple of common cases that you may run into, we'll try to address these below.
NLtoSQLException: Language model failed to generate a valid SQL query after 2 tries
If you see the above error returned, HeavyIQ could not generate valid SQL for your question. You should also see the SQL that was generated that is not valid. You can then copy and paste this into a new cell and edit it to fix the SQL before re-running.