API Selection for Databricks
By default, Databricks uses Unity Catalog, which blocks Spark catalog registration. In this case, you must use the TableProvider API (format-based access). However, if you disable Unity Catalog by creating a cluster with No isolation shared access mode, you can use the Catalog API instead. The Catalog API provides centralized configuration and native Spark SQL integration.| Unity Catalog Status | Recommended API | Notes |
|---|---|---|
| Enabled (default) | TableProvider API (format-based) | Unity Catalog blocks Spark catalog registration |
| Disabled (No isolation shared) | Catalog API | Requires cluster with “No isolation shared” access mode |
Installation on Databricks
Option 1: Upload JAR via Databricks UI
-
Build or download the runtime JAR:
-
Upload the JAR to your Databricks workspace:
- Go to Workspace → Navigate to your desired folder
- Click Upload → Select the JAR file
- The JAR will be stored in your workspace
-
Install the library on your cluster:
- Go to Compute → Select your cluster
- Click the Libraries tab
- Click Install New
- Select DBFS or Workspace → Navigate to the uploaded JAR file
- Click Install
- Restart the cluster to load the library
Option 2: Install via Databricks CLI
Option 3: Maven Coordinates (Recommended)
-
Navigate to your Databricks workspace:
- Go to Compute → Select your cluster
- Click the Libraries tab
- Click Install New
- Select Maven tab
- Add the Maven coordinates:
- Click Install and restart the cluster to load the library
Using TableProvider API
When Unity Catalog is enabled (default), you must use the TableProvider API (format-based access) because Unity Catalog blocks Spark catalog registration. If you’ve disabled Unity Catalog by using a cluster with “No isolation shared” access mode, you can use the Catalog API instead.Reading data
- Python
- Scala
Writing data
- Python
- Scala
This example assumes preconfigured secret scopes in Databricks. For setup instructions, see the Databricks Secret management documentation.
Databricks-specific considerations
Access mode requirements
The ClickHouse Spark Connector requires Dedicated (formerly Single User) access mode. Standard (formerly Shared) access mode isn’t supported when Unity Catalog is enabled, as Databricks blocks external DataSource V2 connectors in that configuration.| Access Mode | Unity Catalog | Supported |
|---|---|---|
| Dedicated (Single User) | Enabled | ✅ Yes |
| Dedicated (Single User) | Disabled | ✅ Yes |
| Standard (Shared) | Enabled | ❌ No |
| Standard (Shared) | Disabled | ✅ Yes |
Secret management
Use Databricks secret scopes to securely store ClickHouse credentials:ClickHouse Cloud connection
When connecting to ClickHouse Cloud from Databricks:- Use HTTPS protocol (
protocol: https,http_port: 8443) - Enable SSL (
ssl: true)
Examples
Complete workflow example
- Python
- Scala
Related documentation
- Spark Native Connector Guide - Complete connector documentation
- TableProvider API Documentation - Format-based access details
- Catalog API Documentation - Catalog-based access details