Connect to Databricks
You can connect to Databricks and make it available as a resource in Retool. Once complete, your users can write queries that interact with Databricks data.
Requirements
All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.
To create a Databricks resource, you first need to retrieve your database connection details from your Databricks SQL account. To reach this page, go to SQL Warehouses in Databricks and select the warehouse you would like to connect to.
1. Create a new resource
Sign in to your Retool organization and navigate to the Resources tab. Click Create new, then select Resource.
2. Select the resource type
Retool can connect to almost any API or database, and has built-in integrations for popular data sources. Select the Databricks resource type.
3. Configure the resource
Create a new Databricks resource in Retool, and enter your database connection details. Retool recommends copying the connection string and using the Import from connection string option to quickly connect to Databricks.
If you do not use a connection string to import your settings, enter the following settings.
General
Setting | Description |
---|---|
Host | The workspace URL of your Databricks instance. |
Port | The port number. |
HTTP path | The HTTP path of your SQL warehouse. |
Default Catalog | The default catalog to use. |
Default Schema | The default schema to use. |
Connection options | Additional options to customize your connection. |
Use SSL/TLS | Connect to your database with SSL/TLS. |
Authentication
You can authenticate into Databricks using a personal access token in the Authentication section. Select API Key Auth and enter your personal access token as an API key.
4. Save the resource
Click Create resource to complete the setup. You can then click either Create app to immediately start building a Retool app or Back to resources to return to the list of resources.
5. Query Databricks
Your Databricks resource is now ready to use. To interact with Databricks data, select the resource in the query editor. If you specified a Catalog in the resource form, you can omit the catalog when writing your query.
Hosted instances
If you use a hosted instance of Databricks, ensure that the instance is running before you run any Databricks queries in Retool. If the instance is not running, the first query starts the Databricks instance but will likely time out doing so.
In addition, the first query to a Databricks instance after start-up may be noticeably slower. This is a known issue with hosted Databricks instances.
Schema editor
The schema for Databricks is retrieved from the information_schema
table in the system
catalog. Your Databricks instance must have Unity Catalog enabled in order to show schemas in Retool.