Connecting Klaviyo and Databricks
Advanced KDP is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our billing guide 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.
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 and Understanding Data Warehouse Event Import.
To set up Databricks as a destination for Klaviyo data, see How to export Klaviyo data to Databricks.
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.
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
- 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
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 |
|---|---|---|
|
| Allows Klaviyo to create and manage temporary tables during sync. |
|
| Allows Klaviyo to read your tables and views. |
-- 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.
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:
SHOW SCHEMAS IN main; -- replace 'main' with your catalog if differentYou should see:
klaviyo_import_from_dwh
klaviyo_tmp4.2 Test authentication (using your PAT)
Use the Databricks CLI with the same token you plan to provide to Klaviyo:
# 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 meExpected 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
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.
-- 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.
- In Klaviyo, navigate to Advanced > Data management > Syncing.
- If you already have a connection, click Create sync.
- Select Import data from your data warehouse.
- Choose Databricks as your data warehouse.
- 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: |
HTTP Path | The HTTP path of the SQL Warehouse to use for queries. | In the Databricks UI:
Example: |
Catalog | The catalog containing your Klaviyo schemas (e.g., | 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:
- Click Next. On Test connection, click Test. If the test fails, correct the connection details or permissions and test again.
- After the test succeeds, click Next. At least 1 accessible table or view must be present in
KLAVIYO_IMPORT_FROM_DWHto continue. - 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.
- 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.