> ## Documentation Index
> Fetch the complete documentation index at: https://honeydew.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Databricks

Databricks connects to Honeydew via JDBC using the Trino protocol.
Two modes are supported:

* **Live connection**: query Honeydew directly from Databricks dashboards and notebooks.
* **Data import**: materialize Honeydew query results as Databricks tables or views,
  then use them like any other Databricks dataset.

<Tip>
  Use an [API Key](/docs/access-control/api-keys) for authentication.
</Tip>

## Setting up a JDBC connection

<Steps>
  <Step title="Upload the Trino JDBC driver">
    Databricks requires the Trino JDBC driver to be stored in a Unity Catalog Volume.

    1. Download the [Trino JDBC driver](https://repo.maven.apache.org/maven2/io/trino/trino-jdbc/480/trino-jdbc-480.jar).
    2. In your Databricks workspace, upload the downloaded JAR file to a Unity Catalog Volume,
       for example `/Volumes/<catalog>/<schema>/jars/`.

    <Note>
      For details on uploading files to Volumes, see the
      [Databricks JDBC connection documentation](https://docs.databricks.com/aws/en/connect/jdbc-connection).
    </Note>
  </Step>

  <Step title="Create the JDBC connection">
    <Tabs>
      <Tab title="Databricks UI">
        1. Navigate to **Catalog** → **Create** → **Create a connection**
        2. Set a **Connection name** (e.g., `honeydew-jdbc`) and set **Connection type** to **JDBC**
        3. Provide the connection details:
           * **URL**: `jdbc:trino://jdbc.honeydew.cloud:443/<workspace>__<branch>`
           * **JAR dependency**: select the path to the uploaded Trino JDBC driver in your Volume
           * **External options**: `dbtable,query`
           * **Additional options**: add two key-value pairs:
             | Key        | Value           |
             | ---------- | --------------- |
             | `user`     | your API key    |
             | `password` | your API secret |
        4. Click **Create connection**
      </Tab>

      <Tab title="SQL">
        Run the following SQL in a Databricks notebook or SQL editor:

        ```sql theme={null}
        CREATE OR REPLACE CONNECTION `honeydew-jdbc` TYPE JDBC
        ENVIRONMENT (
          java_dependencies '["/Volumes/<catalog>/<schema>/jars/trino-jdbc-480.jar"]'
        )
        OPTIONS (
          url 'jdbc:trino://jdbc.honeydew.cloud:443/<workspace>__<branch>',
          user '<api key>',
          password '<api secret>',
          externalOptionsAllowList 'dbtable,query'
        );

        DESCRIBE CONNECTION `honeydew-jdbc`;
        ```
      </Tab>
    </Tabs>

    Replace:

    * `<workspace>__<branch>` with your Honeydew workspace and branch.
      For the `prod` branch, omit `__<branch_name>` (e.g., use `my_workspace` not
      `my_workspace__prod`).
    * `<api key>` and `<api secret>` with your [API key](/docs/access-control/api-keys) credentials

    <Note>
      The JDBC connection requires external network access to reach `jdbc.honeydew.cloud`.
      See [network connectivity for JDBC](https://docs.databricks.com/aws/en/connect/jdbc-connection#network-connectivity)
      in the Databricks documentation for instructions on configuring external network access.
    </Note>

    <Note>
      If your organization uses a custom JDBC hostname, find it in the Honeydew UI
      under **Settings** > **JDBC**.
    </Note>
  </Step>

  <Step title="Grant connection access">
    Grant the `USE CONNECTION` privilege to any users or roles that need to query Honeydew:

    ```sql theme={null}
    GRANT USE CONNECTION ON CONNECTION `honeydew-jdbc` TO <user-or-role>;
    ```

    See [Databricks: Grant the USE privilege](https://docs.databricks.com/aws/en/connect/jdbc-connection#step-3-grant-the-use-privilege)
    for more details.
  </Step>
</Steps>

## Creating datasets and dashboards

Navigate to **Dashboards** in Databricks to create visualizations from Honeydew data.

Create a dataset by writing a SQL query with the `remote_query` function,
referencing the connection name you created above:

```sql theme={null}
SELECT * FROM remote_query('honeydew-jdbc',
  query => 'select "countries.name", SUM("orders.count") as count
            from domains.revenue_analytics');
```

The inner query uses the [Honeydew SQL interface](/docs/integration/sql-interface).
You can reference any domain, metric, or dimension available in your workspace.
In the example above, `domains` is the schema and `revenue_analytics` is the domain name.

Once you have a dataset, add charts and visuals to your Databricks dashboard.

## Data import

You can materialize Honeydew query results as a Databricks table or view,
making them available to any tool or workflow that reads from Databricks.

### Create a table

Use `CREATE TABLE ... AS SELECT` to snapshot the query results into a Databricks table:

```sql theme={null}
CREATE TABLE <catalog>.<schema>.<table_name> AS
SELECT * FROM remote_query('honeydew-jdbc',
  query => 'select "countries.name", SUM("orders.count") as count
            from domains.revenue_analytics');
```

Re-run this statement to refresh the table with the latest data from Honeydew.

### Create a view

Use `CREATE VIEW` to define a view that queries Honeydew on each access:

```sql theme={null}
CREATE OR REPLACE VIEW <catalog>.<schema>.<view_name> AS
SELECT * FROM remote_query('honeydew-jdbc',
  query => 'select "countries.name", SUM("orders.count") as count
            from domains.revenue_analytics');
```

The view re-executes the Honeydew query each time it is queried, so it always
reflects the current state of the semantic layer.
