Datalore Help

Database integration (Datalore Enterprise only)

Datalore Enterprise provides UI that allows you to create database connections, attach them to a notebook, and retrieve their data for your code.

Add a database connection

This procedure explains how to add a database connection to a workspace. You can then attach this database to any number of the notebooks from the respective workspace.

  1. On the Home page, select the workspace where you want to create the connection.

    Selecting a workspace
  2. Select Databases from the menu under the workspace name.

  3. Click the Add connection button in the upper-right corner. The New database connection dialog will open.

  4. On the Select type tab, select the database type you want to use.

  5. In the New [database_type_name] connection dialog, fill in the fields.

  6. (Optional) If you have a pre-built connection URL, switch to the Enter URL tab, provide the URL in the text field and click Next. This will open the connection dialog for the respective database type with all the fields pre-filled.

  7. Click the Test connection button at the bottom of the dialog.

  8. Once successfully tested, click the Create connection button.

The newly created connection is added to the Databases list on the home page of the respective workspace. You can now attach the database to notebooks and use the data in the code.

Datababse list on Home page

Attach a database connection to a notebook

  1. Go to Main menu | Tools | Attached data or click the Attached data icon on the left-hand sidebar.

  2. Click Select data to attach to expand the list.

    Selecting a database to attach
  3. From the list, select the database connection you want to attach to the notebook.

The selected item is added to the attachment list. You can do the following:

  • Click New SQL cell to query the database

  • Click the database to expand the detail view and browse the schema

  • Click the vertical ellipsis to refresh the schema, edit the connection, or detach it from the notebook

Query a database in an SQL cell

This procedure explains how to retrieve data from an attached database for further use in your code.

  1. Create an SQL cell:

    • Go to Tools | Attached data and click New SQL cell for the attached database that you want to use.

      Opening an SQL cell from Attached data
    • Hover over the bottom border of a cell and select More cell types | SQL cell. You will be prompted to select the required database if you you have more than one database attached.

      Selecting a database for querying
  2. Enter an SQL statement.

  3. Run the query (Run icon or Ctrl + Enter shortcut). The result set will be shown in the output and saved to a dataframe.

  4. (Optional) To rename the dataframe, click the dataframe name next to RESULT SAVED TO on the SQL toolbar.

Below is an example of two SQL cells used to work with a Snowflake database.

Querying a Snowflake database

Database sharing options

Shared workspace
  • Editors can create and edit database connections.

  • Editors can create and run SQL cells to access the connected databases.

  • Viewers can view the connection list and respective database schemas

Home workspace notebook
  • Editors can create and execute SQL cells to access connected databases.

  • Viewers can only view the currently attached database connections.

Last modified: 18 January 2022