Run a query in a notebook

After creating a notebook, you can write and run SQL queries against different data sources within the same notebook. Query results can be viewed as a table or chart.

Prerequisites

  • You have a global role that has the following global permission: Product Rights > Data Notebook
  • A data source for Data Notebook is registered.

Steps

  1. Open the notebook.
  2. In a new line, enter two forward slashes (//).
    A query block appears.
  3. Enter a title to identify your query.
    Tip You can use this query in another SQL query within the same notebook.
  4. Write your query.
    Note If you can't write or run a non-query statement (for example, UPDATE), it is because your administrator has restricted it.
  5. Connect to a data source.
  6. On the menu next to the query title, select a database.
  7. Click Run.
    Tip 
    • If the data source requires personal credentials to connect to the data source, a dialog box may appear again to prompt you to enter your credentials. In the dialog box, the value in the Duration field indicates the amount of time you want to remain connected to the data source. The default duration is 2 minutes. You can, however, change the duration.
    • To reduce database load, by default, only the first 100 query results are shown. To remove this limit, on the Run menu of the query block, clear the 100-row limit on this query option, and then click Run again. The maximum number of query results that can be shown is 100,000.

    Query results are shown.
    Image of query results as a table
    Image of query results as a chart
Tip 
  • You can edit the query and run it again.
  • To run all the queries in the notebook at once, in the leftmost pane, click Execution, and then click Run all queries. Alternatively, you can use the following keyboard shortcut, depending on your operating system:
    • macOS: Press Command+Shift+Enter
    • Windows: Press Ctrl+Shift+Enter
  • When viewing the query results as a table, to resize the table, drag its border.
  • To download or view the table or chart in full screen, hover your pointer over it, and then click Download results or Download image. If you can't find the Download results button on a table, it is because your administrator has hidden it.

What's next?

Publish the notebook to create an asset.