Connect Databricks
Learn how to integrate Databricks with Harness FME to enable Warehouse Native Experimentation.
Warehouse Native Experimentation allows you to run experiments on data that already lives in your data warehouse. By connecting Harness FME directly to your Databricks SQL warehouse, you can securely query and analyze experiment data from your source of truth.
To begin, connect your Databricks SQL warehouse as a data source using either OAuth machine-to-machine (M2M) authentication with a service principal or a personal access token.
Prerequisites
Ensure that you have the following before getting started:
Access to a Databricks SQL warehouse, including its server hostname and HTTP path
A Unity Catalog catalog and schema containing your experiment data
A designated results table where experiment results are stored
A Databricks service principal with an OAuth client ID and secret, or a personal access token
Setup
Harness recommends the following best practices:
Use a service principal with OAuth M2M authentication rather than a personal access token tied to an individual user.
Grant read-only access to the catalog and schema containing the assignment and event data.
Grant write access only to the experiment results table.
To integrate Databricks as a data warehouse for Warehouse Native Experimentation:
From the Harness FME navigation menu, click FME Settings and click View on a project on the Projects page. Then, navigate to the Data Source tab.
Select Databricks as your data warehouse. In the Data Sources tab of your Harness FME project, select Databricks from the list of supported data warehouses.
Enter the following connection details:
FieldDescriptionExampleServer Hostname
The server hostname of your Databricks SQL warehouse.
dbc-1a2b3c4d-5e6f.cloud.databricks.comPort
The port of your Databricks SQL warehouse. Defaults to
443if not specified.443HTTP Path
The HTTP path of your Databricks SQL warehouse.
/sql/1.0/warehouses/a1b2c3d4e5f67890Azure Databricks workspaces use a server hostname in the form
adb-<workspace-id>.<n>.azuredatabricks.net.
Select an authentication method from the Authentication list. Harness FME supports two authentication methods for connecting to Databricks:
OAuth M2M (recommended): Harness FME authenticates as a Databricks service principal using an OAuth client ID and client secret.
FieldDescriptionClient ID
The OAuth2 client ID of the Databricks service principal.
Client Secret
The OAuth2 client secret of the Databricks service principal.
Personal access token: Provide a Databricks personal access token with read access to the catalog and schema required for experiment metrics, and write access to the results table.
Configure network access for private or IP-restricted workspaces. If your Databricks workspace restricts inbound traffic using an IP access list or private connectivity, Harness must be allowed network access to run experiment calculations against your warehouse.
To enable connectivity:
Add the Harness outbound IP addresses to your workspace IP access list.
Allow traffic on the Databricks SQL warehouse port (default:
443).
Harness FME maintains a list of static outbound IP addresses used for warehouse connections. You must allow these addresses for the connection to succeed.
Test the connection by clicking Test Connection.
Select a catalog and schema. After authentication, Harness FME retrieves the catalogs and schemas accessible to the service principal or token. Select the one containing your assignment and metric source tables.
Specify a results table. Create a results table where Harness FME will write experiment analysis results, and ensure that:
The table exists in your catalog and schema.
The schema matches the expected format for experiment results below.
FieldTypeDescriptionMETRICIDSTRINGUnique identifier for the metric being calculated.
METRICNAMESTRINGHuman-readable name of the metric being calculated.
METRICRESULTIDSTRINGUnique identifier representing a specific calculation per metric, per experiment, per analysis run.
EXPIDSTRINGUnique identifier for the experiment associated with this metric calculation.
EXPNAMESTRINGHuman-readable name of the experiment associated with this metric calculation.
TREATMENTSTRINGThe experiment variant (e.g., Control or Treatment) associated with the metric results.
DIMENSIONNAMESTRINGThe name of the dimension being analyzed (e.g., country, platform).
DIMENSIONVALUESTRINGThe corresponding value of the analyzed dimension.
ATTRIBUTEDKEYSCOUNTBIGINTCount of unique keys (users, sessions, etc.) attributed to this metric result.
REQUESTTIMESTAMPTIMESTAMPTimestamp when the metric computation request occurred.
MINDOUBLEMinimum observed value for the metric.
MAXDOUBLEMaximum observed value for the metric.
COUNTBIGINTTotal number of observations included in the metric calculation.
SUMDOUBLESum of all observed metric values.
MEANDOUBLEAverage (mean) of the metric values.
P50DOUBLE50th percentile (median) metric value.
P95DOUBLE95th percentile metric value.
P99DOUBLE99th percentile metric value.
VARIANCEDOUBLEVariance of the metric values.
EXCLUDEDUSERCOUNTBIGINTNumber of users excluded from the analysis (due to filters, SRM, etc.).
ASOFTIMESTAMPTIMESTAMPTimestamp representing when the result snapshot was written.
To create the results table with the correct structure, run the following SQL statement in Databricks:
Save and activate. Once the test passes, click Save to create the connection.
Your Databricks data source can now be used to create assignment and metric sources for Warehouse Native Experimentation.
Example Databricks configuration
Data Warehouse
Databricks
Server Hostname
dbc-1a2b3c4d-5e6f.cloud.databricks.com
Port
443
HTTP Path
/sql/1.0/warehouses/a1b2c3d4e5f67890
Authentication
OAuth M2M
Catalog
ml
Schema
demo
Results Table
whn_metric_results
Next steps
Go to Preparing Assignment Source Tables for Warehouse Native Experimentation to prepare the assignment data that your experiments read.
Go to Configuring Assignment Sources for Warehouse Native Experimentation to configure an assignment source in Harness FME.
Last updated
Was this helpful?