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.
On the Home page, select the workspace where you want to create the connection.
Select Databases from the menu under the workspace name.
Click the Add connection button in the upper-right corner. The New database connection dialog will open.
On the Select type tab, select the database type you want to use.
In the New [database_type_name] connection dialog, fill in the fields.
(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.
Click the Test connection button at the bottom of the dialog.
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.
Attach a database connection to a notebook
Go to Attached data icon on the left-hand sidebar.or click the
Click Select data to attach to expand the list.
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.
Create an SQL cell:
Go to New SQL cell for the attached database that you want to use.and click
Hover over the bottom border of a cell and select. You will be prompted to select the required database if you you have more than one database attached.
Enter an SQL statement.
Run the query (Run icon or Ctrl + Enter shortcut). The result set will be shown in the output and saved to a dataframe.
(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.
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.