Databricks
Databricks is a data and AI platform built on the lakehouse architecture. Weld connects to it through a SQL warehouse and reads the tables and views governed by Unity Catalog.
Databricks runs on AWS, Microsoft Azure and Google Cloud, and Weld supports all three. A common setup is to build models in Databricks, for example with dbt, and use Weld to sync them into another warehouse such as Redshift, BigQuery or Snowflake.
In addition to its role as a destination, Databricks can be used as an ELT source. One connection can serve both.
AVAILABLE ONLY WITH UNITY CATALOG. Tables in the legacy Hive metastore
(hive_metastore) are not listed.
Features
| Feature name | Supported | |
|---|---|---|
| Column Hashing | True | Column level |
| Blocking | True | Column level |
| Incremental | True | |
| Custom data | True | |
| History | False | |
| ReSync | True | Table level |
| Templates | False |
🔧 Setup Guide
Weld connects as a service principal with OAuth machine-to-machine credentials. It needs four things in your workspace: the service principal itself, the Databricks SQL access entitlement, permission to use a SQL warehouse, and read access to the catalogs you want to sync.
Step 1 - Create a service principal
-
In your Databricks workspace, go to
Settings → Identity and access → Service principals → Manage. -
Press Add service principal → Add new, choose Databricks managed, give it a name such as
weld-service-principaland press Add. -
Open the service principal and go to Configurations. Make sure Databricks SQL access is checked.
Without this entitlement, Databricks refuses every query from the service principal, even when it has permission to use the warehouse.
-
Go to Secrets and press Generate secret. If you are asked to choose scopes, keep the default. Note down the Client ID and the Secret; the secret is only shown once.
On Azure: use a secret generated here, in Azure Databricks. A client secret from Microsoft Entra ID does not work.
Step 2 - Give it a SQL warehouse
Every sync runs its queries on a SQL warehouse you choose.
- Go to
SQL Warehousesand pick an existing warehouse, or create one. A serverless warehouse is recommended: it starts in seconds and stops itself when idle. 2X-Small is enough to start with. - Under Permissions, add the service principal with Can use.
- Under Connection details, note down the Server hostname and HTTP path.
Every sync runs on this warehouse and starts it if it is stopped, and a view is computed again on each sync. Scheduling syncs after your dbt runs finish avoids starting the warehouse twice.
Step 3 - Grant read access
Run the following in the SQL editor, replacing the catalog name and the service principal's Client ID:
Grant read access
GRANT USE CATALOG ON CATALOG analytics TO `<client-id>`;
GRANT USE SCHEMA ON CATALOG analytics TO `<client-id>`;
GRANT SELECT ON CATALOG analytics TO `<client-id>`;
Privileges granted on a catalog also cover the schemas, tables and views created in it later, such as new dbt models. To limit Weld to a single schema, grant USE CATALOG on the catalog and USE SCHEMA and SELECT on that schema instead.
Repeat for every catalog you want Weld to be able to sync from.
Step 4 - Connector Configuration
In Weld, add a Databricks connection and pick the form for your cloud: Databricks on AWS, Databricks on Azure or Databricks on Google Cloud.
| Field | Value |
|---|---|
| Server Hostname | From the warehouse's connection details. The workspace URL also works. |
| HTTP Path | From the warehouse's connection details, like /sql/1.0/warehouses/1a2b3c |
| OAuth Client ID | The service principal's Client ID (Application ID) |
| OAuth Client Secret | The secret generated in step 1 |
| Unity Catalog Volume | Leave empty, unless you also use Databricks as a destination |
The hostname looks different on each cloud:
| Cloud | Server hostname |
|---|---|
| AWS | dbc-a1b2c3d4-e5f6.cloud.databricks.com |
| Azure | adb-1234567890123456.7.azuredatabricks.net |
| Google Cloud | 1234567890123456.7.gcp.databricks.com |
Once connected, Weld lists the catalogs the service principal can see. Select the ones to sync from. Every table and view in them becomes available to sync, named catalog.schema.table.
Whitelist Weld's IP pool
If your workspace uses IP access lists, allow requests from Weld's IP pool:
3.64.84.1393.65.119.16935.156.133.78
Workspaces that only accept traffic over Private Link cannot be reached by Weld.
Step 5 - Data To Sync
Tables can always be updated in the configuration settings of the sync.
- Select the tables and views you wish to include in the sync.
You can view the schema, remove columns or hash sensitive information. - Update Sync mode, which can be set to:
- Incremental Sync: pick a column that changes whenever a row does, such as
updated_ator an auto-incrementing id. Each sync fetches only the rows added or changed since the last one. Deleted rows are not removed from the destination. - Full Sync: each sync replaces the destination table, so deleted rows disappear too. This suits dbt models materialized as
table. - Append Only: rows are added to the destination table and never updated. This suits event and log tables.
- Incremental Sync: pick a column that changes whenever a row does, such as
ARRAY, MAP, STRUCT and VARIANT columns arrive as JSON strings,
BIGINT columns as strings so every digit is kept, DECIMAL columns as
double-precision numbers, and TIMESTAMP_NTZ values as UTC timestamps. A
DECIMAL with more than 15 digits can lose precision, and fails the sync if
it is a primary key column. To keep exact values, cast the column to STRING
in a view and sync the view.
Step 6 - Configure Sync
- Select how often you would like the data to sync.
- Check the Destination schema name, which is where the tables land in your warehouse, and click Start Initial Sync.
Weld will take over from here and commence syncing data from your Databricks workspace.