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

# Databricks

> Grant Pavo read access to your Databricks workspace.

## 1. Databricks Access Setup

### Step 1: Create a Service Principal or Access Token

Create a dedicated service principal in your Databricks workspace that Pavo will use to access your data.

| Option                          | Best For                | Security Level                             |
| ------------------------------- | ----------------------- | ------------------------------------------ |
| Service Principal (Recommended) | Production environments | High – can be scoped to specific resources |
| Personal Access Token (PAT)     | Quick setup / testing   | Medium – tied to a user account            |

To create a Service Principal: Recommended

1. Go to your Databricks Account Console → User Management → Service Principals
2. Click Add Service Principal
3. Name it: pavo-integration (or your preferred name)
4. Generate an OAuth secret
5. Upload the client Id and secret.

To create a PAT (alternative):

1. Go to User Settings → Developer → Access Tokens
2. Click Generate New Token
3. Name it: pavo-integration
4. Set expiration: 90 days (recommended) or as per your security policy

### Step 2: Grant Databricks Permissions

The service principal/token needs the following permissions:

#### Workspace Access

| Permission                       | Purpose                      |
| -------------------------------- | ---------------------------- |
| USE CATALOG on relevant catalogs | Access catalog metadata      |
| USE SCHEMA on relevant schemas   | Access schema metadata       |
| SELECT on relevant tables/views  | Read table data and metadata |
| USAGE on SQL Warehouse           | Execute queries              |

SQL commands to grant access:

```sql theme={null}
-- Grant catalog access
GRANT USE CATALOG ON CATALOG <catalog_name> TO `pavo-integration`;

-- Grant schema access
GRANT USE SCHEMA ON SCHEMA <catalog_name>.<schema_name> TO `pavo-integration`;

-- Grant read access to all tables in a schema
GRANT SELECT ON SCHEMA <catalog_name>.<schema_name> TO `pavo-integration`;

-- Grant access to query history
GRANT USE CATALOG ON CATALOG system TO `pavo-integration`;
GRANT USE SCHEMA ON SCHEMA system.access TO `pavo-integration`;
GRANT SELECT ON system.access.audit TO `pavo-integration`;
```

### Step 3: Create Analysis Schema

<Note>
  This step is only required if you want Pavo to run analysis queries that create temporary tables.
</Note>

1. Create a dedicated schema for Pavo's temporary analysis tables:

```sql theme={null}
CREATE SCHEMA IF NOT EXISTS <catalog_name>.pavo_analysis;
```

2. Grant write permissions:

```sql theme={null}
GRANT ALL PRIVILEGES ON SCHEMA <catalog_name>.pavo_analysis TO `pavo-integration`;
```

### Step 4: Share Connection Details

There is an option to upload these details in a file format on the pavo website.

| Field                        | Example                                                                                    | Required |
| ---------------------------- | ------------------------------------------------------------------------------------------ | -------- |
| Workspace URL                | [https://your-workspace.cloud.databricks.com](https://your-workspace.cloud.databricks.com) | ✅ Yes    |
| HTTP Path                    | /sql/1.0/warehouses/abc123def456                                                           | ✅ Yes    |
| UUID                         | uuid..                                                                                     | ✅ Yes    |
| Access Token / OAuth Secret  | dapi1234567890...                                                                          | ✅ Yes    |
| Catalog(s) to access         | main, analytics                                                                            | ✅ Yes    |
| Schema(s) to access          | sales, marketing, finance                                                                  | ✅ Yes    |
| Analysis schema (if created) | main.pavo\_analysis                                                                        | Optional |

To find your HTTP Path:

1. Go to SQL → SQL Warehouses
2. Click on your warehouse → Connection details tab
3. Copy the HTTP Path

### Questions

1. What all entities (catalogs, schemas, tables/views/objects) you are using?
2. What all entities (catalogs, schemas, tables/views/objects) are required for the POCs.
