Skip to end of banner
Go to start of banner

Databricks - Multi Execute

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

In this article

Overview

You can use this Snap to run one or more Databricks SQL statements on your target Databricks Lakehouse Platform (DLP) instance. You can run the following types of queries using this Snap:

  • Data Definition Language (DDL) queries

  • Data Manipulation Language (DML) queries

  • Data Control Language (DCL) queries

The Snap runs each statement as a single atomic unit so as to allow rolling back changes when a statement fails during its execution.

Snap Type

Databricks - Multi Execute Snap is a write-type Snap that can read, fetch, and write data and tables into a target DLP instance.

Prerequisites

  • Valid access credentials to a DLP instance with adequate access permissions to perform the action in context.

  • Valid access to the external source data in one of the following: Azure Blob Storage, ADLS Gen2, DBFS, GCP, AWS S3, or another database (JDBC-compatible).

Support for Ultra Pipelines  

Does not support Ultra Pipelines

Limitations

  • This Snap does not support multi-statement transaction rollback.

  • Each statement is auto-committed upon successful execution. In the event of a failure, the Snap can rollback only updates corresponding to the failed statement execution. All previous statements (during that Pipeline execution runtime) that ran successfully are not rolled back.

  • You cannot run Data Query Language (DQL) queries using this Snap. For example, SELECT and WITH query constructs.

Known Issues

None.

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

  • Min: 0

  • Max: 1

  • JSON Generator

  • Mapper

  • Copy

  • Databricks - Select

Input document is not mandatory. The Snap can fetch and apply values for parameterized queries from an upstream Snap output.

Output

Document

  • Min: 0

  • Max: 1

  • Databricks - Select

  • Databricks - Insert

A JSON document containing each SQL statement along with its execution status (or result).

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap Settings

  • Asterisk ( * ): Indicates a mandatory field.

  • Suggestion icon ((blue star)): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ((blue star) ): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ( (blue star) ): Indicates that you can add fields in the fieldset.

  • Remove icon ( (blue star)): Indicates that you can remove fields from the fieldset.

Field Name

Field Type

Description

Label*

Default ValueDatabricks - Multi Execute
ExampleDb_MultiQuery

String

The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

SQL Statements*

Use this fieldset to define your SQL statements, one in each row. You can add as many SQL statements as you need.

SQL statement*

Default Value: None.
Examplecreate table employee (name String, age BigInt)

String/Expression

Specify the Databricks SQL statement you want the Snap to execute. The SQL statement must follow the SQL syntax as stipulated in DLP.

Manage Queued Queries

Default valueContinue to execute queued queries when pipeline is stopped or if it fails.

Example: Cancel queued queries when pipeline is stopped or if it fails

Dropdown list

Select this property to determine whether the Snap should continue or cancel the execution of the queued Databricks SQL queries when you stop the Pipeline.

If you select Cancel queued queries when pipeline is stopped or if it fails, then the read queries under execution are cancelled, whereas the write type of queries under execution are not cancelled. Databricks internally determines which queries are safe to be cancelled and cancels those queries.

Due to an issue with DLP, aborting an ELT Pipeline validation (with preview data enabled) causes only those SQL statements that retrieve data using bind parameters to get aborted while all other static statements (that use values instead of bind parameters) persist.

  • For example, select * from a_table where id = 10 will not be aborted while select * from test where id = ? gets aborted.

To avoid this issue, ensure that you always configure your Snap settings to use bind parameters inside its SQL queries.

Snap Execution

Default ValueExecute only
Example: Validate & Execute

Dropdown list

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Troubleshooting

Error

Reason

Resolution

Missing property value

You have not specified a value for the required field where this message appears.

Ensure that you specify valid values for all required fields.

Examples

Replacing old data in a DLP table with the latest data

Consider the scenario where the data in a DLP table becomes obsolete every few hours. We need to refresh the data in the table on a frequent basis. To do so, we can create the following Pipeline with only Databricks - Multi Execute Snap.

Configure the Snap (Pipeline) to run two Databricks SQL statements in a specific order - Delete the existing table and create a new table with the same schema as the source file and populate the latest values into this new table. Ensure that the DLP account used with the Snap has the required permissions to perform operations you specify in your SQL statements.

The Snap upon successful validation displays the output in the preview pane as follows. This output contains the SQL statement we passed and the respective result of execution.

Download this Pipeline

Downloads

  1. Download and import the Pipeline into SnapLogic.

  2. Configure Snap accounts as applicable.

  3. Provide Pipeline parameters as applicable.

  File Modified
No files shared here yet.

Snap Pack History

Release

Snap Pack Version

Date

Type

Updates

November 2024

main29029

Stable

Updated and certified against the current SnapLogic Platform release.

August 2024

main27765

Stable

Upgraded the org.json.json library from v20090211 to v20240303, which is fully backward compatible.

May 2024

437patches27246

Latest

Added Databricks - Run Job. This Snap executes a job, checks its status in Databricks, and, based on the job's status, completes or fails the pipeline.

May 2024

437patches26400

Latest

Fixed an invalid session handle issue with the Databricks Snap Pack that intermittently triggered an error message when the Snaps failed to connect with Databricks to execute the SQL statement.

May 2024

main26341

Stable

Updated the Delete Condition (Truncates a Table if empty) field in the Databricks - Delete Snap to Delete condition (deletes all records from a table if left blank) to indicate that all entries will be deleted from the table when this field is blank, but no truncate operation is performed.

February 2024

main25112

Stable

Updated and certified against the current SnapLogic Platform release.

November 2023

main23721

Stable

Updated and certified against the current SnapLogic Platform release.

August 2023

main22460

Stable

Updated and certified against the current SnapLogic Platform release.

May 2023

433patches21630

Latest

Enhanced the performance of the Databricks - Insert Snap to improve the amount of time it takes for validation.

May 2023

main21015

Stable

Upgraded with the latest SnapLogic Platform release.

February 2023

main19844

Stable

Upgraded with the latest SnapLogic Platform release.

November 2022

main18944

Stable

The Databricks - Insert Snap now creates the target table only from the table metadata of the second input view when the following conditions are met:

  • The Create table if not present checkbox is selected.

  • The target table does not exist.

  • The table metadata is provided in the second input view.

September 2022

430patches18305

Latest

The following fields are added to each Databricks Snap as part of this enhancement:

  • Number of Retries: The number of attempts the Snap should make to perform the selected operation when the Snap account connection fails or times out.

  • Retry Interval (seconds): The time interval in seconds between two consecutive retry attempts.

September 2022

430patches17796

Latest

The Manage Queued Queries property in the Databricks Snap Pack enables you to decide whether a given Snap should continue or cancel executing the queued Databricks SQL queries.

August 2022

main17386

Stable

Upgraded with the latest SnapLogic Platform release.

4.29.2.0

42920rc17045

Latest

A new Snap Pack for Databricks Lakehouse Platform (Databricks or DLP) introduces the following Snaps:


  • No labels