---
title: "Connecting Klaviyo and Databricks"
description: "Overview: Follow these steps to prepare Databricks for Klaviyo. You’ll create required schemas (in a catalog), set up a dedicated account and access token for Klaviyo, assign the minimum required privileges, verify the configuration, and connect Databricks to Klaviyo."
canonical_url: "https://help.klaviyo.com/hc/en-us/articles/42790208080283"
markdown_url: "https://help.klaviyo.com/hc/en-us/articles/42790208080283.md"
locale: "en-us"
category: "Advanced KDP & Personalization"
section: "Syncing"
updated: "2026-10-26"
---

# Connecting Klaviyo and Databricks

**📝 Note:** [Advanced KDP](https://help.klaviyo.com/hc/en-us/articles/17655007276059.md) is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our [billing guide](https://help.klaviyo.com/hc/en-us/articles/115000976672.md) to learn about how to purchase this plan.

# Set up Databricks imports

**Overview:** Follow these steps to prepare Databricks for imports into Klaviyo. You’ll create required *schemas* (in a catalog), set up a dedicated account and access token for Klaviyo, assign the required privileges, verify the configuration, and create an import sync in Klaviyo.

**Important:** Databricks supports both **importing data into Klaviyo** and **exporting Klaviyo data to Databricks**. Configure imports and exports separately.

- **Profiles** and **Events** can be imported into Klaviyo and exported to Databricks.

- **Unity Catalog** is required. To connect to a Databricks instance that uses Hive metastore (HMS), consider [Hive metastore federation](https://docs.databricks.com/aws/en/query-federation/hms-federation-concepts).



For details on how data warehouse imports work in Klaviyo—including schema structure, required tables, and field mappings—see [How Data Warehouse Imports Work in Klaviyo](https://help.klaviyo.com/hc/en-us/articles/40939206649627.md) and [Understanding Data Warehouse Event Import.](https://help.klaviyo.com/hc/en-us/articles/45442043369499.md)

To set up Databricks as a destination for Klaviyo data, see [How to export Klaviyo data to Databricks](https://help.klaviyo.com/hc/en-us/articles/56749052645019.md).

---

Before you begin, choose a Databricks SQL warehouse for Klaviyo to query. You need permission to create schemas and grant access, or help from a Databricks admin.

## 1) Create required schemas

In Databricks, **schemas** (sometimes called databases) live **inside a catalog**. The examples use the `main` catalog. Replace it with your catalog throughout these steps.

```sql
USE CATALOG main;  -- or your organization’s designated catalog
CREATE SCHEMA IF NOT EXISTS KLAVIYO_IMPORT_FROM_DWH;
CREATE SCHEMA IF NOT EXISTS KLAVIYO_TMP;
```

- `KLAVIYO_IMPORT_FROM_DWH`: Tables and views created in this schema will be available for selection when configuring a new sync.

- `KLAVIYO_TMP`: temporary/staging data used during sync.



**Note:** Before testing the connection in Klaviyo, create at least 1 table or view containing the data you want to import in `KLAVIYO_IMPORT_FROM_DWH`. Prepare its identifiers and timestamp fields using the import guides linked above.

---

## 2) Create the Klaviyo service account and access token

Klaviyo authenticates to Databricks using a dedicated account with a **personal access token (PAT)**. Use a non-human (service) account when possible and store the PAT securely (e.g., a password manager or secret store). You will provide this token to Klaviyo during initial setup.

### 2.1 Create the account

Create a Databricks workspace user or a service principal that Klaviyo will use exclusively for this integration.

### 2.2 Generate the personal access token

- **Workspace user account:** Generate the token via the Databricks web UI (see Databricks docs): [Create personal access tokens for workspace users](https://docs.databricks.com/aws/en/dev-tools/auth/pat#create-personal-access-tokens-for-workspace-users)

- **Service principal:** Ask a Databricks workspace admin to generate the initial token using the Databricks CLI (see Databricks docs): [Create personal access tokens via the Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/auth/pat#create-personal-access-tokens-for-service-principals)



**Important:** Treat the PAT as a secret. Anyone with the token can access Databricks with the associated account’s permissions.

---

## 3) Assign required permissions

Grant the Databricks identity you created for Klaviyo access to the catalog and the schemas created in Step 1. Replace `klaviyo_service_user` with your Databricks username or the service principal’s application ID, and prefix schemas with your catalog (e.g., `main`).

| Schema | Minimum required privileges | Purpose |
| --- | --- | --- |
| `KLAVIYO_TMP` | `ALL PRIVILEGES` *or* the combination of `USE SCHEMA`, `MODIFY`, `SELECT`, and `CREATE TABLE` | Allows Klaviyo to create and manage temporary tables during sync. |
| `KLAVIYO_IMPORT_FROM_DWH` | `USE SCHEMA`, `SELECT` | Allows Klaviyo to read your tables and views. |

```sql
-- Grant access to the catalog
GRANT USE CATALOG ON CATALOG main TO `klaviyo_service_user`;

-- Grant permissions on temporary schema
GRANT ALL PRIVILEGES ON SCHEMA main.KLAVIYO_TMP TO `klaviyo_service_user`;

-- OR, grant granular privileges:
GRANT USE SCHEMA, MODIFY, SELECT, CREATE TABLE ON SCHEMA main.KLAVIYO_TMP TO `klaviyo_service_user`;

-- Grant read-only access to import schema
GRANT USE SCHEMA, SELECT ON SCHEMA main.KLAVIYO_IMPORT_FROM_DWH TO `klaviyo_service_user`;

```

Give the same Databricks identity **CAN USE** permission on the SQL warehouse whose **HTTP Path** you will enter in Klaviyo. Schema grants do not grant access to the warehouse. See [Databricks SQL warehouse permissions](https://docs.databricks.com/aws/en/security/auth/access-control/#sql-warehouse-acls).

**Best practice:** Apply the principle of least privilege—grant only what’s required.

---

## 4) Verify your setup (optional)

### 4.1 Confirm the schemas exist

Run in a Databricks SQL notebook or editor:

```sql
SHOW SCHEMAS IN main;  -- replace 'main' with your catalog if different
```

You should see:

```auto
klaviyo_import_from_dwh
klaviyo_tmp
```

### 4.2 Test authentication (using your PAT)

Use the Databricks CLI with the same token you plan to provide to Klaviyo:

```bash
# Set your token and host (example for AWS)
export DATABRICKS_HOST="https://<your-workspace>.cloud.databricks.com"
export DATABRICKS_TOKEN="<your-PAT>"

# Run a simple API call
databricks current-user me
```

*Expected result:* JSON output showing the user or service principal details (e.g., display name, user ID). If you get an HTTP 403 or authentication error, verify the token and host URL.

### 4.3 Check permissions on each schema

```sql
SHOW GRANTS ON CATALOG main;
SHOW GRANTS ON SCHEMA main.klaviyo_tmp;
SHOW GRANTS ON SCHEMA main.klaviyo_import_from_dwh;
```

Confirm that the Databricks identity you created for Klaviyo has `USE CATALOG` on the catalog, `USE SCHEMA` and `SELECT` on `KLAVIYO_IMPORT_FROM_DWH`, and the temporary-schema privileges listed in Step 3. Also confirm its **CAN USE** permission on the SQL warehouse.

### 4.4 Validate create, write, and read operations

Use an unused table name for `klaviyo_permissions_test` in `KLAVIYO_TMP`. Replace `example_source_table` with a table or view you plan to import.

```sql
-- Test create, write, read, and drop in KLAVIYO_TMP
USE SCHEMA main.klaviyo_tmp;
CREATE TABLE klaviyo_permissions_test (id INT);
INSERT INTO klaviyo_permissions_test VALUES (1);
SELECT * FROM klaviyo_permissions_test;
DROP TABLE klaviyo_permissions_test;

-- List sources and test reading a table or view you plan to import
USE SCHEMA main.klaviyo_import_from_dwh;
SHOW TABLES;
SELECT * FROM example_source_table LIMIT 1;
```

**Tips:**

- Run these verification steps using the same identity and PAT that you’ll share with Klaviyo.

- Retain the SQL grant statements and verification output for audit/troubleshooting.

- Rotate the PAT on a regular cadence and after staff changes.



---

## 5) Connect Databricks and create an import sync

Once Databricks is configured, open the import setup in Klaviyo.

1. In Klaviyo, navigate to **Advanced > Data management > Syncing**.

2. If you already have a connection, click **Create sync**.

3. Select **Import data from your data warehouse**.

4. Choose **Databricks** as your data warehouse.

5. Click **Connect to Databricks**.



When prompted, provide the following connection details:

| Field | Description | Where to find it |
| --- | --- | --- |
| **Server hostname** | The hostname of your Databricks workspace, without https:// or a trailing slash. | Found in your browser’s address bar when logged into Databricks: `https://<your-workspace>.cloud.databricks.com`  Example: `abc-12345678.cloud.databricks.com` |
| **HTTP Path** | The HTTP path of the SQL Warehouse to use for queries. | In the Databricks UI:  1. Go to **SQL Warehouses**.  2. Select the warehouse you plan to use.  3. Copy the **HTTP Path** under **Connection details**.    Example: `/sql/1.0/warehouses/1234abcd5678efgh` |
| **Catalog** | The catalog containing your Klaviyo schemas (e.g., `main`). | Verify using:  SHOW CATALOGS; |
| **Access token** | The personal access token (PAT) you created in Step 2. | Store and paste the token securely during setup. |

After entering your connection details, test the connection and finish the import sync:

1. Click **Next**. On **Test connection**, click **Test**. If the test fails, correct the connection details or permissions and test again.

2. After the test succeeds, click **Next**. At least 1 accessible table or view must be present in `KLAVIYO_IMPORT_FROM_DWH` to continue.

3. Enter a name for the sync and select the table or view to import. Choose **Profiles** or **Events** and a cadence: **Manual** or **Schedule run**. For a scheduled sync, set the interval, start date, start time, and timezone. Click **Next**.

4. On **Map properties**, select the timestamp column for change detection and complete the required mappings for your data type. For an event sync, also configure the event type and event timestamp. Use a separate column for change detection. Click **Done** to save the connection and import sync.



---

Your saved import sync appears on **Syncing**. Scheduled syncs use the cadence you selected. For a manual sync, open the Databricks connection and select **Run manually** from the sync’s actions menu to start importing data.
