Databricks
Connect & Ingest data from / to a Databricks database
Setup
The following credentials keys are accepted:
host(required) -> The hostname of the Databricks workspace (e.g.,dbc-a1b2c3d4-e5f6.cloud.databricks.com)token(required) -> The personal access token or password to access the instancewarehouse_id(required) -> The SQL warehouse ID to connect tohttp_path(optional) -> The HTTP path for the connection (if not using warehouse_id)catalog(optional) -> The initial catalog name to use in the session (default:hive_metastore)schema(optional) -> The initial schema name to use in the session (default:default)port(optional) -> The port number (default:443)max_rows(optional) -> Maximum number of rows fetched per request (default:10000)internal_volume(optional) -> Specifies a custom internal volume to use for bulk operations. If not provided, Sling will attempt to create a volume in the default schema namedSLING_SCHEMA.SLING_STAGING.table_format(optional) -> The table format to use when Sling creates a table. Acceptsdeltaoriceberg(default:delta). See Table Format below.copy_method(optional) -> How Sling bulk-loads into Databricks.stageuses a Unity Catalog volume andCOPY INTO(default).awsuses S3.zerobusstreams Arrow RecordBatches into a Delta table (Beta). See Zerobus below.timeout(optional) -> Timeout in seconds for server query execution (no timeout by default)user_agent_entry(optional) -> Used to identify partnersansi_mode(optional) -> Boolean for ANSI SQL specification adherence (default:false)timezone(optional) -> Timezone setting (default:UTC)
Using sling conns
Here are examples of setting a connection named DATABRICKS. We must provide the type=databricks property:
Environment Variable
See here to learn more about the .env.sling file.
Sling Env File YAML
See here to learn more about the sling env.yaml file.
Table Format
Sling creates Delta tables by default. To create Managed Iceberg tables instead, set table_format to iceberg on the connection:
Or with sling conns:
The format applies to the tables Sling creates, including the temporary tables used for incremental and backfill modes. All load modes and merge strategies work the same for both formats.
To control the DDL further, use the table_ddl target option, which overrides table_format:
Zerobus
Set copy_method: zerobus to ingest with Databricks Zerobus instead of staging files. This is still the same type: databricks connection (there is no type: zerobus). The SQL warehouse is used for DESCRIBE, CREATE TABLE, TRUNCATE, and MERGE; Zerobus only streams rows into the Delta table.
This is Beta.
Credentials
On top of host, token, and warehouse_id:
copy_method(required for Zerobus) ->zerobusclient_id(required) -> OAuth M2M service principal application IDclient_secret(required) -> OAuth M2M client secretzerobus_endpoint(optional) -> Zerobus shard URL, not the workspace host. Example:https://<workspace-id>.zerobus.<region>.cloud.databricks.com. On Azure the suffix isazuredatabricks.net; on GCP it isgcp.databricks.com. If omitted, Sling tries to detect it from Unity Catalog.batch_size(optional) -> Rows per Arrow RecordBatch (default:10000)ipc_compression(optional) -> Arrow IPC compression:none(default),lz4, orzstdmax_inflight_batches(optional) -> In-flight batches waiting for acknowledgment (default:1000)
Create a service principal and secret in the workspace, then grant it access to the target catalog/schema:
See Authorize service principal access to Databricks with OAuth.
Using sling conns
Sling Env File YAML
If you are facing issues connecting, give sling assist a try, or reach out to us at support@slingdata.io, on discord or open a Github Issue here.
Last updated
Was this helpful?