You can create a pipeline that writes back data from an Anaplan Data Orchestrator dataset to Databricks.
Prerequisites
You need a connection to Databricks to create a pipeline. Make sure you meet the prerequisites in these sections before you create a connection to Databricks and a writeback pipeline.
Connectivity prerequisites
Writeback pipeline prerequisites
Create a connection to Databricks
To create a connection:
- Select Data Orchestrator from the top-left navigation menu.
- Choose a dataspace from the list.
- Select Connections from the left-side panel.
- Select Create connection.
- On the Create connection page, select Databricks, and then select Next.
If you don't find the connector, enter a search term in the Find... field. - On the Connection details page, enter these details and select Next:
- Name: Create a name for your connection. The name can contain alphanumeric characters and underscores.
- Description: Optionally, enter a description about your connection.
- On the Connection credentials page, enter your Google credentials and select Next.
See the table below for information about each field.
| Connection credentials | Description |
| Host | The Databricks workspace URL. You can find the host in your browser’s address bar. You don't need to include https:// in the host. |
| Port | The port number for your Databricks SQL warehouse connections. The default port number is 443. To find the port number in your Databricks workspace:
|
| HTTP Path | The HTTP path of your Databricks database. To find the HTTP path in your Databricks workspace:
|
| Catalog | The Databricks database catalog defines the data namespace you want to access. To find the catalog in your Databricks workspace, select Catalog in the left-side panel. A list of available catalogs displays. Use the catalog name for the Catalog field in your Databricks connection. |
| Schema | The Databricks database schema defines the data namespace you want to access. To find the schema in your Databricks workspace, select Catalog in the left-side panel, and then select a catalog. The schemas display within the catalog. Use the schema name for the Schema field in your Databricks connection. |
| Client ID and Secret | These credentials are used to authenticate your application. You can get the client ID and secret by creating a service principal in Databricks. This is the recommended and most secure method for headless authentication. To create a service principle, you must be a workspace administrator in Databricks. To create a service principal and get credentials:
Important: Remember to grant this new service principal the necessary permissions on your SQL warehouse, catalog, and schema for the connector to be able to access the data. You can do this from the permissions tabs in the respective UI sections. |
- After the connection test is complete, select Done.
Create a writeback pipeline
When you set up the writeback pipeline, you'll use your connection to export either a source dataset or a transformation view dataset (derived dataset) from Data Orchestrator to Databricks.
To create a writeback pipeline:
- Select Data Orchestrator from the top-left navigation menu.
- Choose a dataspace from the list.
- Select Pipelines from the left-side panel.
- Select Create pipeline.
- Enter a Name for your pipeline and then select Create.
You are taken to the pipeline designer view. - Select the Source icon, and then complete these steps in the right-side panel:
- Select Anaplan from the Connection type dropdown.
- Select Datasets from the Choose connection dropdown.
- Enter a new Label to change the source display name in the designer view.
- Select Source location, choose a Data Orchestrator dataset, and then select Confirm.
The dataset is used as the source for your pipeline.
- Optionally, select the add icon that appears between the Source and Sink nodes.
You can add steps to your pipeline to process data. - Select the Sink icon, and then complete these steps in the right-side panel:
- Select Databricks from the Connection type dropdown.
- Select the Databricks connection you created from the Choose connection dropdown.
- Enter a new Label to change the sink name that displays in the designer view.
- Select Target location > Table, select a Databricks table, and then select Done.
- Select Target mapping, map the Data Orchestrator source dataset values to the Databricks target values, and then select Done.
- Select a Write option for the target table: Append, Full replace, or Upsert.
This determines how data is written to the target table. See the Write options section below for more details.
- Select Publish, and then select Run to execute the data transfer.
Write options
Review this table to determine which write option to select.
| Write options | Description |
| Append | Adds all rows from the source data to the existing rows in the target table. If you select Append, a staging table in Databricks is required:
See the Staging table section below for more information. Note: Append load isn't suitable for target tables with primary keys. |
| Full replace | Deletes all existing data in the target table and replaces it with the source data. If you select Full replace, a staging table in Databricks is recommended and selected by default:
|
| Upsert | Updates existing rows and adds new rows based on a specified key. If you select Upsert, a staging table in Databricks is required:
See the Staging table section below for more information. |
Staging tables
Staging tables are used to compare and process data before Data Orchestrator loads the data to the final target table in Databricks.
If you want to use a staging table, you have the option to:
- Automatically let Data Orchestrator create a staging table in Databricks.
- Manually specify an existing staging table in Databricks.
This table describes how staging tables are used in Databricks for each option.
| Staging table options | Results |
| Automatically create a staging table in Databricks | After you run the pipeline:
|
| Manually specify an existing staging table from Databricks | After you run the pipeline:
|
Note: To prevent data mismatch errors with Databricks, make sure your data in Data Orchestrator and in Databricks have a schema alignment. This means the tables in Data Orchestrator and in Databricks must have the same columns and data types.
Verify the writeback in Databricks
Once the pipeline is successfully completed, you can log in to your Databricks account to verify the data load.
Navigate to the target database, schema, and table specified in the pipeline configuration. The data written from the Data Orchestrator dataset is available in the target table, based on the selected write option (append, full replace, or upsert).