Databricks is a unified data analytics platform that allows organizations to easily process, analyze, and visualize large amounts of data. It combines data engineering, data science, and machine learning capabilities in a single platform, making it easier for teams to collaborate and derive insights from their data.
The CData SSIS Components enhance SQL Server Integration Services by enabling users to easily import and export data from various sources and destinations.
In this article, we explore the data type mapping considerations when exporting to Databricks and walk through how to migrate Azure Data Lake Storage data to Databricks using the CData SSIS Components for Azure Data Lake Storage and Databricks.
Data Type Mapping
| Databricks Schema |
CData Schema |
|
int, integer, int32
|
int
|
|
smallint, short, int16
|
smallint
|
|
double, float, real
|
float
|
|
date
|
date
|
|
datetime, timestamp
|
datetime
|
|
time, timespan
|
time
|
|
string, varchar
|
If length > 4000: nvarchar(max), Otherwise: nvarchar(length)
|
|
long, int64, bigint
|
bigint
|
|
boolean, bool
|
tinyint
|
|
decimal, numeric
|
decimal
|
|
uuid
|
nvarchar(length)
|
|
binary, varbinary, longvarbinary
|
binary(1000) or varbinary(max) after SQL Server 2000
|
Special Considerations
-
String/VARCHAR: String columns from Databricks can map to different data types depending on the length of the column. If the column length exceeds 4000, then the column is mapped to nvarchar (max). Otherwise, the column is mapped to nvarchar (length).
- DECIMAL Databricks supports DECIMAL types up to 38 digits of precision, but any source column beyond that can cause load errors.
Prerequisites
Create the project and add components
-
Open Visual Studio and create a new Integration Services Project.
π Create the SSIS project
-
Add a new Data Flow Task to the Control Flow screen and open the Data Flow Task.
-
Add a CData Azure Data Lake Storage Source control and a CData Databricks Destination control to the data flow task.
π Add the source and destination controls (Salesforce is shown)
Configure the Azure Data Lake Storage source
Follow the steps below to specify properties required to connect to Azure Data Lake Storage.
-
Double-click the CData Azure Data Lake Storage Source to open the source component editor and add a new connection.
π Open the source component editor (Salesforce is shown)
-
In the CData Azure Data Lake Storage Connection Manager, configure the connection properties, then test and save the connection.
Authenticating to a Gen 1 DataLakeStore Account
Gen 1 uses OAuth 2.0 in Entra ID (formerly Azure AD) for authentication.
For this, an Active Directory web application is required. You can create one as follows:
- Sign in to your Azure Account through the
- Select "Entra ID" (formerly Azure AD).
- Select "App registrations".
- Select "New application registration".
- Provide a name and URL for the application. Select Web app for the type of application you want to create.
- Select "Required permissions" and change the required permissions for this app. At a minimum, "Azure Data Lake" and "Windows Azure Service Management API" are required.
- Select "Key" and generate a new key. Add a description, a duration, and take note of the generated key. You won't be able to see it again.
To authenticate against a Gen 1 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen1.
- Account: Set this to the name of the account.
- OAuthClientId: Set this to the application Id of the app you created.
- OAuthClientSecret: Set this to the key generated for the app you created.
- TenantId: Set this to the tenant Id. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
Authenticating to a Gen 2 DataLakeStore Account
To authenticate against a Gen 2 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen2.
- Account: Set this to the name of the account.
- FileSystem: Set this to the file system which will be used for this account.
- AccessKey: Set this to the access key which will be used to authenticate the calls to the API. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
π Configure the source connection (Salesforce is shown)
-
After saving the connection, select "Table or view" and select the table or view to export into Databricks, then close the CData Azure Data Lake Storage Source Editor.
π Select the table to export (Salesforce is shown)
Configure the Databricks destination
With the Azure Data Lake Storage Source configured, we can configure the Databricks connection and map the columns.
-
Double-click the CData Databricks Destination to open the destination component editor and add a new connection.
π Open the destination component editor
-
In the CData Databricks Connection Manager, configure the connection properties, then test and save the connection. To connect to a Databricks cluster, set the properties as described below.
Note: The needed values can be found in your Databricks instance by navigating to Clusters, selecting the desired cluster,
and selecting the JDBC/ODBC tab under Advanced Options.
-
Server: Set to the Server Hostname of your Databricks cluster.
-
HTTPPath: Set to the HTTP Path of your Databricks cluster.
-
Token: Set to your personal access token (this value can be obtained by navigating to the User Settings page of your Databricks instance and selecting the Access Tokens tab).
Other helpful connection properties
-
QueryPassthrough: When this is set to True, queries are passed through directly to Databricks.
-
ConvertDateTimetoGMT: When this is set to True, the components will convert date-time values to GMT, instead of the local time of the machine.
-
UseUploadApi: Setting this property to true will improve performance if there is a large amount of data in a Bulk INSERT operation.
-
UseCloudFetch: This option specifies whether to use CloudFetch to improve query efficiency when the table contains over one million entries.
π Configure the destination connection
-
After saving the connection, select a table in the Use a Table menu and in the Action menu, select Insert.
π Choose the destination table
-
On the Column Mappings tab, configure the mappings from the input columns to the destination columns.
π Map the columns (Salesforce is shown)
Run the project
You can now run the project. After the SSIS Task has finished executing, data from your SQL table will be exported to the chosen table.