Skip to main content

Striim Platform 5.4.2 documentation

Databricks Writer Programmer's Reference

This page provides a complete reference for Databricks Writer properties and configuration. For step-by-step setup procedures, see Databricks Writer Initial Setup. For application creation, see Create a Databricks Writer Application.

Databricks Writer Properties

Property

Type

Required

Default

Description

authenticationType

String

Yes

—

Authentication method: PersonalAccessToken, ServicePrincipal, ManualOAuth, or EntraID

catalog

String

Yes

—

Databricks catalog name (must exist)

CDDLAction

String

No

Process

How to handle DDL changes: Process, Ignore, or Stop

clientID

String

Conditional*

—

The UUID of the Service Principal (for ServicePrincipal auth). Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

clientSecret

String

Conditional*

—

The Client Secret generated in the Databricks account console (for ServicePrincipal auth). Keep this secure.

connectionRetryPolicy

String

No

initialRetryDelay=10s, retryDelayMultiplier=2, maxRetryDelay=1m, maxAttempts=5, totalTimeout=10m

Retry behavior. Format: initialRetryDelay=Xs, retryDelayMultiplier=N, maxRetryDelay=Xs, maxAttempts=N, totalTimeout=Xs

connectionUrl

String

Yes

—

JDBC connection URL to your Databricks workspace. Format: jdbc:databricks://myworkspace.cloud.databricks.com:443

externalStageConnectionProfileName

String

Conditional

—

Name of a Connection Profile for staging. If specified, inline staging properties are ignored.

externalStageType

String

Yes

—

Staging type: S3, ADLS, GCS, DBFS, or PersonalStagingLocation

gcsBucketName

String

Conditional**

—

Name of your GCS bucket (when externalStageType is GCS). Format: lowercase alphanumeric with hyphens. Example: my-staging-bucket

gcsBucketRegion

String

Conditional**

—

GCP region where your bucket is located (when externalStageType is GCS). Examples: us-central1, us-east1, europe-west1

gcsProjectId

String

Conditional**

—

Your Google Cloud Project ID (when externalStageType is GCS and not using externalStageConnectionProfileName). Example: my-gcp-project

gcsServiceAccountKey

String

Conditional**

—

Path to Google Cloud Service Account Key JSON file (when externalStageType is GCS and not using externalStageConnectionProfileName).

optimizedMerge

Boolean

No

true

Whether to use optimized merge operations

personalAccessToken

String

Conditional*

—

Your Databricks workspace PAT (for PersonalAccessToken auth). Keep this secure.

schema

String

Yes

—

Databricks schema name (must exist)

storageCredentialName

String

Conditional**

—

Name of the Storage Credential created in Databricks Unity Catalog (when externalStageType is GCS). See Databricks Writer Initial Setup – Step 1.

uploadPolicy

String

No

eventcount:50000,interval:120s

When to flush staged data. Format: eventcount:N,interval:Ms where N = event count, Ms = milliseconds. Example: eventcount:100000,interval:60s flushes when 100,000 events accumulate OR 60 seconds elapse. See Upload Policy and Flush Behavior for tuning guidance.

writeMode

String

No

Merge

Write mode: Merge (matches source changes) or Append (audit trail mode)

*Conditional on authenticationType: Required for ServicePrincipal; required for PersonalAccessToken (personalAccessToken instead); optional for other auth types.

**Conditional on externalStageType: Required when set to GCS; storageCredentialName required for all GCS configurations. Other properties depend on whether using externalStageConnectionProfileName or inline configuration.

Authentication
Authentication Types

Databricks Writer supports multiple authentication mechanisms. Choose based on your deployment model and credential-management strategy.

Type

Required Properties

Supported Platforms

Use Case

Personal Access Token (PAT)

connectionUrl, personalAccessToken

AWS, Azure, Google Cloud

Short-lived applications; development/testing; simple deployments

Service Principal (M2M OAuth)

connectionUrl, clientID, clientSecret

AWS, Azure, Google Cloud

Long-running applications; automation; credential rotation

Manual OAuth

connectionUrl, clientID, clientSecret, tenantID, refreshToken

AWS, Azure, Google Cloud

Manual token refresh

Entra ID

connectionUrl

Azure (recommended)

Azure AD integration

Personal Access Token (PAT) Properties

Property

Type

Required

Description

authenticationType

String

Yes

Set to PersonalAccessToken

personalAccessToken

String

Yes

Your Databricks workspace PAT

Service Principal (M2M OAuth) Properties

Property

Type

Required

Description

authenticationType

String

Yes

Set to ServicePrincipal

clientID

String

Yes

The UUID of the Service Principal. Obtain from the Databricks account console. Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

clientSecret

String

Yes

The Client Secret generated in the Databricks account console. Keep this secure.

See Service Principal Authentication for step-by-step setup.

External Staging
Supported Staging Types

Type

Platforms

Description

S3

AWS

Amazon S3 bucket for staging

ADLS Gen2

Azure

Azure Data Lake Storage Gen2 account for staging

GCS

Google Cloud

Google Cloud Storage bucket for staging

DBFS

AWS, Azure, Google Cloud

Databricks File System root directory for staging

Personal Staging Location

AWS, Azure, Google Cloud

Personal staging location in the Databricks workspace

GCS Property Validation

Property

Validation

Error Message

storageCredentialName

Must exist in Databricks; must not be empty

"Storage Credential '{name}' not found. Create it in Databricks before using it here."

gcsBucketName

Must be a valid GCS bucket name; must be accessible

"GCS bucket '{name}' not found or is inaccessible. Verify it exists and permissions are correct."

gcsBucketRegion

Must match where the bucket is located

"Invalid GCS region '{region}'. Verify this is where your bucket is located."

gcsProjectId

Must be a valid, accessible GCP project ID

"Invalid GCP project ID '{id}'. Verify it is correct and accessible."

gcsServiceAccountKey

Must be a valid JSON file path; file must exist

"Service Account Key file not found at '{path}'" or "Invalid Service Account Key (not valid JSON)"

Write Modes and Operation Semantics

Databricks Writer supports two write modes. Choose based on your business requirements.

Merge Mode

In Merge mode, Striim updates Databricks to reflect all source changes, keeping Databricks synchronized with the source.

Source Operation

Databricks Behavior

INSERT

New row inserted into Databricks

UPDATE

Existing row updated (matched by primary key or unique constraint)

DELETE

Existing row deleted from Databricks

Requirement: The Databricks table must have a primary key or unique constraint matching the source. Otherwise, Striim cannot identify which row to update or delete.

Result: The Databricks table mirrors the source table at any point in time.

Example: If your source table has ID=1, Name='Alice', Age=30, and you update Age to 31 in the source, Databricks is updated to reflect the new value: ID=1, Name='Alice', Age=31.

When to use: Real-time analytics, operational reporting, compliance snapshots where data must match the source.

Append-Only Mode

In Append-Only mode, Striim treats all source changes (inserts, updates, and deletes) as INSERT operations, preserving a complete history.

Source Operation

Databricks Behavior

INSERT

New row appended

UPDATE

New row appended (old row preserved)

DELETE

New row appended (marked as deleted or flagged)

Result: The Databricks table contains a complete history of all changes. This allows you to see how data has evolved over time.

Example: Using the same source data, if you update Alice's age to 31, Databricks now contains both rows:

  • ID=1, Name='Alice', Age=30 (original)

  • ID=1, Name='Alice', Age=31 (updated, new row)

This allows you to see the age change as a separate historical entry.

When to use: Audit trails (all changes visible), historical analysis (track all versions), time-series reporting (month-over-month comparisons).

Schema Evolution (CDDL)

When the source schema changes (columns added, removed, or modified), Striim can detect and respond to these changes based on your CDDLAction setting.

Setting

Behavior

Example

CDDLAction: "Process" (default)

Striim creates new columns in Databricks. Existing rows receive NULL for new columns.

Source adds a phone column. Databricks automatically creates it.

CDDLAction: "Ignore"

Striim logs the change but does not apply it. Databricks schema remains unchanged. Source data for the new column is ignored.

Source adds phone. Databricks ignores it. New phone data is lost.

CDDLAction: "Stop"

Application stops. You must manually update the schema and restart.

Source adds phone. Application stops. You manually add the column to Databricks, then restart.

Recommendation: Use CDDLAction: "Process" unless you have a specific reason to control schema changes manually.

Batching and Upload Policy
Upload and Flush Policy

The uploadPolicy property controls when Striim flushes staged data and executes COPY INTO.

Default: eventcount:50000,interval:120s

Format: eventcount:N,interval:Ms

  • N = number of events to accumulate

  • Ms = milliseconds before flushing

Example: eventcount:100000,interval:60s means flush when 100,000 events accumulate OR 60 seconds elapse (whichever comes first).

For detailed tuning guidance, see Upload Policy and Flush Behavior in Runtime Considerations.

Connection Retry Policy

Control how Striim retries failed connections.

Default: initialRetryDelay=10s, retryDelayMultiplier=2, maxRetryDelay=1m, maxAttempts=5, totalTimeout=10m

Format:

  • initialRetryDelay=Xs — Initial wait before first retry

  • retryDelayMultiplier=N — Multiplier for exponential backoff

  • maxRetryDelay=Xs — Maximum wait between retries

  • maxAttempts=N — Maximum number of retry attempts

  • totalTimeout=Xs — Total time allowed for all retries

Table Mapping Format

When using TQL or Flow Designer with custom table mappings, specify mappings in the format:

<source_table>,<target_schema>.<target_table>

Example:

MYSQL_SOURCE.PRODUCTS,warehouse.product_dimension
MYSQL_SOURCE.INVENTORY,warehouse.inventory_fact

This allows you to rename tables or change their schema location as they are written to Databricks.

Databricks Writer Runtime Considerations

This page describes how Databricks Writer behaves during operation, including operational behavior, monitoring, and troubleshooting.

Batching and Data Flow Behavior
How Striim Writes Data to Databricks

Striim does not write directly to Databricks tables. Instead, Striim stages data in an external storage area (GCS, S3, ADLS, DBFS, or Personal Staging Location), then uses the Databricks COPY INTO command to load batches into Delta Lake tables.

Write process:

  1. Striim buffers incoming events in memory.

  2. When the uploadPolicy threshold is reached (event count or time interval, whichever comes first), Striim flushes the buffer.

  3. Striim writes data files to the staging area.

  4. Striim executes a COPY INTO command to load the staged files into Databricks tables.

  5. After successful load, Striim deletes the staged files.

  6. Striim commits a checkpoint to remember where it stopped reading the source.

Advantages: Batching improves throughput, guarantees ACID consistency (entire batch succeeds or fails), and allows validation before committing.

Implications: Writes are not instantaneous (delayed by uploadPolicy interval). If the application crashes before COPY INTO completes, staged files remain in the staging area.

Upload Policy and Flush Behavior

The uploadPolicy property controls when Striim flushes staged data.

Default: eventcount:50000,interval:120s

Format: eventcount:N,interval:Ms

  • N = number of events to accumulate before flushing

  • Ms = milliseconds before flushing (even if event count not reached)

Example: eventcount:100000,interval:60s means:

  • Flush when 100,000 events have accumulated, OR

  • Flush after 60 seconds have passed (whichever comes first)

Tuning guidance:

High throughput sources: Increase eventcount to reduce staging writes. Example: eventcount:500000,interval:300s (fewer but larger batches).

Low latency requirements: Decrease interval for faster data arrival in Databricks. Example: eventcount:10000,interval:30s (more frequent flushes).

Storage-constrained: Decrease eventcount to avoid large accumulated files. Example: eventcount:10000,interval:120s (smaller batches).

Application Failure and Recovery
Normal Application Stop

When you stop a Databricks Writer application:

  1. Striim finishes processing in-flight events.

  2. Any data in the buffer is flushed to the staging area.

  3. A COPY INTO command loads the staged data.

  4. The checkpoint is committed.

  5. The application stops cleanly.

Result: No data is lost. On restart, the application resumes from the checkpoint.

Abnormal Failure (Crash or Network Partition)

If the Striim server crashes or loses network connectivity:

  1. Data in the buffer (not yet flushed) is lost.

  2. Data written to the staging area remains there.

  3. The checkpoint is not updated.

On recovery (when the application restarts):

  1. Striim detects staged files from the previous run.

  2. Striim executes COPY INTO to load the staged data.

  3. Striim resumes reading from the last committed checkpoint.

Important: You may have duplicate data if the checkpoint was not at the point of failure. Striim guarantees at-least-once delivery. If duplicates are unacceptable, use Merge mode with a primary key.

Staged File Cleanup

Staged files are deleted automatically after successful COPY INTO. However, if the application crashes before COPY INTO completes, or if COPY INTO fails, staged files may remain.

Best practice: Set storage lifecycle policies to delete old files:

GCS: Use lifecycle rules to delete objects older than 7 days:

gsutil lifecycle set - << 'EOF'
{
  "lifecycle": {
    "rule": [
      {
        "action": {"type": "Delete"},
        "condition": {"age": 7}
      }
    ]
  }
}
EOF

S3: Use S3 Lifecycle rules via AWS console or CLI to expire objects after 7 days.

ADLS: Use blob storage lifecycle management in the Azure portal.

GCS Staging-Specific Behavior
Storage Credential Requirements

When using GCS as the staging area, Striim uses the Databricks Storage Credential to authenticate COPY INTO commands. The Storage Credential is a reference to a Google Cloud service account created in Databricks.

Before COPY INTO can succeed:

  1. The Storage Credential must exist in Databricks Unity Catalog

  2. The Storage Credential must be granted READ FILES permission to the Databricks user or Service Principal

  3. The underlying Google Cloud service account must have GCS permissions

Automatic Bucket Creation

If you want Striim to automatically create your GCS bucket (if it doesn't exist), the Google Cloud service account must have the storage.buckets.create permission.

If the permission is missing and the bucket doesn't exist, COPY INTO fails with "Bucket not found."

Regional Optimization

For best performance and cost:

  • Place your GCS bucket in the same region as your Databricks workspace

  • Cross-region data transfer incurs egress charges and increased latency

Example: If your Databricks workspace is in us-central1, place your GCS bucket in us-central1 as well.

GCS Setup Errors and Troubleshooting

Error

Cause

Resolution

Storage Credential not found in Databricks

The storageCredentialName does not exist or is misspelled

Verify the credential was created in Databricks (see Databricks Writer Initial Setup – Step 1). Check the name matches exactly.

GCS bucket not found

The bucket does not exist, or the Databricks service account cannot access it

Verify the bucket exists in GCS. Verify the Databricks service account has Storage Object Viewer role in Google Cloud IAM (see Databricks Writer Initial Setup – Step 2).

Permission denied: Storage Object Viewer required

The Databricks service account lacks GCS permissions

Grant Storage Object Viewer (and Storage Object Creator for auto-creation) in Google Cloud IAM (see Databricks Writer Initial Setup – Step 2).

Permission denied: READ FILES privilege required

The Databricks user/Service Principal lacks READ FILES permission on the Storage Credential

Grant READ FILES permission in Databricks (see Databricks Writer Initial Setup – Step 3).

Invalid Service Account Key file

The gcsServiceAccountKey path is incorrect, or the JSON file is corrupt

Verify the file path exists and is readable by the Striim server. If corrupt, download a fresh Service Account Key from Google Cloud IAM.

Connection refused: Cannot reach GCS

Network connectivity issue or invalid bucket region

Verify network connectivity to storage.googleapis.com. Verify gcsBucketRegion is correct.

Service Principal (M2M OAuth) Behavior
Automatic Token Refresh

When using Service Principal authentication, Striim automatically obtains and refreshes OAuth access tokens:

  • Initial authentication: When the application starts, Striim exchanges your Client ID and Client Secret for an access token

  • Token expiration: Databricks access tokens expire after a period (typically 1 hour)

  • Automatic refresh: Before expiration, Striim automatically obtains a new token using the Client Secret

  • No manual action needed: Your long-running application continues without interruption

Credential Rotation

If you need to rotate your Service Principal credentials:

  1. In the Databricks account console, go to the Service Principal

  2. Click the Credentials & Secrets tab

  3. Generate a new Client Secret (the old one remains active for a grace period)

  4. Update your Striim configuration with the new Client Secret

  5. Restart your Striim application (before the old secret becomes inactive)

Striim will use the new secret when the access token is next refreshed.

Service Principal Errors and Troubleshooting

Error

Cause

Resolution

Authentication failed: Client ID not found

The Client ID (Service Principal UUID) is invalid, or the Service Principal has been deleted

Verify the Client ID is a valid UUID. If the Service Principal was deleted, create a new one in the Databricks account console and update your Striim configuration.

Authentication failed: Client Secret invalid

The Client Secret is incorrect or has expired

Verify the Client Secret is exact (copy-paste from Databricks, not typed). If expired, generate a new Client Secret in the Databricks account console.

Permission denied: User does not have workspace access

The Service Principal lacks User permission on the workspace

Grant User permission to the Service Principal in the Databricks account console (see Databricks Writer Initial Setup – Step 3).

Permission denied: User does not have USE CATALOG privilege

The Service Principal lacks USE CATALOG permission

Grant USE CATALOG permission to the Service Principal on the relevant catalog in Databricks (see Databricks Writer Initial Setup – Step 4).

Permission denied: User does not have MODIFY privilege

The Service Principal lacks MODIFY permission on target tables (Merge mode)

Grant MODIFY permission to the Service Principal on the target tables.

Connection refused: Cannot reach Databricks

The Connection URL is incorrect, or the Databricks workspace is down

Verify the Connection URL is correct. Try accessing your Databricks workspace in a browser to confirm it's running.

Token refresh failed

Striim cannot refresh the access token (network issue or credentials revoked)

Verify network connectivity to Databricks. If the Service Principal or Client Secret has been revoked, restart the application with new credentials.

Monitoring and Metrics

Striim exposes the following metrics for Databricks Writer applications:

Application-Level Metrics

Metric

Description

Status

Current state: Running, Paused, Stopped, Failed

Uptime

How long the application has been running

Events Received

Total events read from the source

Events Written

Total events successfully written to Databricks

Events Failed

Total events that encountered errors

Data Volume Written

Total bytes written to Databricks

Throughput

Events per second (or bytes per second)

Databricks Writer-Specific Metrics

Metric

Description

Staged Files Created

Number of data files staged to GCS/S3/etc

Staged Files Deleted

Number of staged files deleted after successful COPY INTO

COPY INTO Executions

Number of times COPY INTO was executed

Merge Operations

Number of rows merged (Merge mode only)

Append Operations

Number of rows appended (Append-Only mode only)

Failed COPY INTOs

Number of failed COPY INTO commands

Accessing Metrics

In the Striim UI:

  1. Navigate to Applications and select your application

  2. Click the Metrics tab

  3. View real-time graphs and historical trends

Via API: See the Striim REST API documentation for metric query endpoints.

Setting Alerts

You can configure alerts to notify you when:

  • Application stops unexpectedly

  • Events failed exceeds a threshold

  • Throughput drops below expected levels

  • Staged files accumulate (indicating COPY INTO failures)

See Striim Alerts and Notifications documentation for details.

Performance Tuning
Parallelism

You can create multiple Databricks Writer instances in the same application to increase throughput. Each instance reads a subset of source data and writes independently to Databricks.

Configuration: In Flow Designer or TQL, set the parallelThreads property:

CREATE APPLICATION parallel_writer
OUTPUT TO Databricks (
  -- ... other properties ...
  parallelThreads: 4  -- Use 4 parallel instances
)
SELECT * FROM source;

Considerations:

  • Increases CPU usage on both source and Databricks

  • Increases staging area writes

  • May improve throughput in high-volume scenarios

  • Each instance maintains separate checkpoints (more complex recovery)

Staging Area Size and Retention

Staged files consume storage. Monitor your staging area and set retention policies as described in Staged File Cleanup.

Concurrency and Locking
Multiple Writers to the Same Table

Multiple Databricks Writer applications can write to the same Databricks table safely using Delta Lake's ACID guarantees. Each COPY INTO command acquires a table lock for the duration of the operation.

Best practice: If you have multiple writers to the same table, configure each with a different uploadPolicy interval to avoid contention:

  • Writer 1: uploadPolicy: "eventcount:50000,interval:120s"

  • Writer 2: uploadPolicy: "eventcount:50000,interval:140s"

This staggers the COPY INTO operations and reduces lock wait times.

Concurrent Changes from Source

If multiple sources are updating the same Databricks table, Striim applies changes in order received (per source). Cross-source ordering is not guaranteed.

Implication: If source A and source B both update the same row, the final state in Databricks may not match either source perfectly if a specific ordering is expected.

Solution: Ensure your application architecture handles concurrent updates appropriately (use timestamps or sequence numbers to determine correct order).

Limitations and Constraints

Striim's Databricks Writer has the following limitations and constraints:

Batch-mode only: Striim writes data in batch mode using the COPY INTO command. Real-time (streaming) writes are not supported.

GCS regional restriction: GCS stage type can only be used with Databricks on Google Cloud. If you are on AWS or Azure, use S3 or ADLS Gen2 respectively.

Service Principal + DBFS incompatibility: Service Principal authentication cannot be used with DBFS stage type. Use PAT authentication with DBFS, or use Service Principal with S3, ADLS Gen2, or GCS.

Legacy catalog limitation: DBFS stage type cannot be used with Databricks instances where legacy (hive_metastore) catalog is disabled. This is the default for instances created after December 19, 2025. If you require DBFS staging, you must either use a workspace with hive_metastore enabled, or switch to S3, ADLS Gen2, or GCS.

Staged file cleanup timing: Staged files are cleaned up after successful COPY INTO. If the application crashes before successful load, files may remain in the staging area until the application restarts.

Schema compatibility: Your Databricks table schema must be compatible with the source schema. Incompatible data types or mismatched column counts cause COPY INTO to fail.

Concurrency: Multiple Databricks Writer instances can write to the same table using ACID guarantees. To avoid lock contention, configure each with a different uploadPolicy interval.

Client library versions: Databricks Writer uses specific versions:

  • Databricks JDBC driver: 2.7.1

  • Databricks REST client: 3.2.2 (for M2M OAuth)

  • google-cloud-storage: 2.43.1 (for GCS staging)