> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/reference/data-sources/databricks.md).

# Databricks

UI Bakery allows you to easily connect to a Databricks SQL database with no need for additional layers like APIs or third-party services.

## Configuration

### Prerequisites

Before connecting Databricks to UI Bakery, make sure you have:

* A Databricks workspace URL.
* A SQL warehouse path.
* Access to the target catalog and schema.
* One of the supported authentication methods:
  * A Databricks personal access token.
  * A Databricks service principal with OAuth credentials for Client Credentials Flow.

If your database is hosted behind a Firewall, you need to add our [IP addresses](/concepts/data-sources.md#whitelisting-ip-addresses) to the Firewall whitelist.

### Authentication methods

UI Bakery supports two authentication methods for Databricks:

| Method                  | Use when                                                                                           | Required fields          |
| ----------------------- | -------------------------------------------------------------------------------------------------- | ------------------------ |
| Access token            | You want to connect with an existing Databricks personal access token. This is the default method. | Access token             |
| Client Credentials Flow | You want UI Bakery to connect as a Databricks service principal instead of an individual user.     | Client ID, Client secret |

#### **Access token**

Use this option to connect with a Databricks personal access token.

To configure it:

1. In the Authentication settings section, select **Access token**.
2. Enter your Databricks **Access token**.
3. Fill in the rest of the connection settings.
4. Click **Test connection**.

#### **Client Credentials Flow**

Use this option to connect through a Databricks service principal. This method does not require a user login, redirect, or consent screen in UI Bakery. UI Bakery connects to Databricks using the service principal credentials.

To configure it:

1. Create or choose a Databricks service principal.
2. Make sure the service principal has access to the required Databricks SQL warehouse, catalog, schema, and tables.
3. Create an OAuth secret for the service principal in Databricks.
4. In UI Bakery, open the Databricks data source connection settings.
5. In the Authentication settings section, select **Client Credentials Flow**.
6. Enter the service principal **Client ID**.
7. Enter the service principal **Client secret**.
8. Fill in the rest of the connection settings.
9. Click **Test connection**.

The client secret is stored as an encrypted credential in UI Bakery.

For more information about Databricks service principal OAuth credentials, see the Databricks [documentation](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m) on OAuth machine-to-machine authentication.

### Connecting the data source

Now, to connect your data source, follow the steps below:

1. On the **Data sources** page, click **Connect**, and select *Databricks* in the Data sources list.
2. Specify all the required credentials and click **Test connection**.
3. Once the connection is verified, click **Connect Datasource** to complete the setup.

<figure><img src="/files/yKuWjoC8of5FoY445RCL" alt=""><figcaption></figcaption></figure>

UI Bakery will extract the database structure and store column types. This data will be used to suggest the proper [table columns and form field types](/concepts/components/work-with-components/field-types-and-types-recognition.md).

If you need to be able to override the default data source catalog with a custom value in the action, you can enable the **Allow override catalog name in action** setting in the *Data source connection* windo&#x77;**.** \
Once enabled, you will be able to specify a custom database when configuring an action. In case a database is not specified, the default data source database will be used.

<figure><img src="/files/uo1PHD8EbjBMGVGWdZFX" alt=""><figcaption></figcaption></figure>

## Usage

Once you have established the connection between UI Bakery and Databricks, you can access its data - load it and send it back.&#x20;

UI Bakery supports the [SQL Query](/reference/working-with-actions/sql-query.md) action step for this data source.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uibakery.io/reference/data-sources/databricks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
