Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

The Snowflake Multi Execute Snap is a Write type Snap that enables you to execute multiple queries as a single atomic unit. This means that. if any query fails in execution, the changes are rolled back. This Snap supports executing all Snowflake queries.

Expected Input and Output

While the Snap does not require an input document, it supports document input and generates document outputs. Snaps that accept or generate documents can be used upstream or downstream of the Snap.

Expected upstream Snaps:  The dynamic variables used in the execute query can be defined by providing values upstream. Document-generating Snaps such as JSON Generator can be used in upstream.
 
Expected downstream Snaps: The Snap will output one document for every record retrieved, hence any document processing Snap can be used downstream. 

Prerequisites

  • Read and write access to the Snowflake instance. Insert excerpthttps://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438549/Snowflake+-+Bulk+Loadhttps://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438549/Snowflake+-+Bulk+Loadnopaneltrue
  • Security Prerequisites: You should have the following permissions in your Snowflake account to execute this Snap:

    Infoiconfalse

    Usage (DB and Schema): Privilege to use database, role, and schema.

    Create table: Privilege to create table on database. role and schema.

    The following commands enable minimum privileges in the Snowflake Console:

Code Block
grant usage on database <database_name> to role <role_name>;
grant usage on schema <database_name>.<schema_name>;
 
grant "CREATE TABLE" on database <database_name> to role <role_name>;
grant "CREATE TABLE" on schema <database_name>.<schema_name>;

For more information on Snowflake privileges, refer to Access Control Privileges.

Internal SQL Commands

The permissions to grant for using commands depends on the queries you provide in this Snap.

Configuring Accounts

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Snowflake Account for information on setting up this type of account.

Configuring Views

Input

This Snap has at most one document input view.
OutputThis Snap has at most one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

None.

Limitations and Known Issues

  • Select statement and transactional statements such as Begin, Commit, and Rollback are not supported. 
  • Changes made to the database using Data Definition Language (DDL) queries are not rolled back if the Snap fails, this is since DDL statements are always auto-committed by default.
    If there is one DDL query among other queries that the Snap is executing, then the rollback is only for the changes made by the queries executed after the DDL query. Ensure that the Disable session auto-commit property is selected when using DDL queries. See Snowflake Auto-commit for details.
    This is not applicable to Data Modification Language (DML) queries.
  • The Snap may break existing Pipelines if the JDBC Driver is updated to a newer version.

    Note
    titleSnowflake Execute and Multi-Execute Snaps may break existing Pipelines if the JDBC Driver is updated to a newer version.

    With the updated JDBC driver (version 3.12.3), the Snowflake Execute and Multi-Execute Snaps' output displays a Status of "-1" instead of "0" without the Message field upon successfully executing DDL statements. If your Pipelines use these Snaps and downstream Snaps use the Status field's value from these, you must modify the downstream Snaps to proceed on a status value of -1 instead of 0.

    This change in the Snap behavior follows from the change introduced in the Snowflake JDBC driver in version 3.8.1:
    "Statement.getUpdateCount() and PreparedStatement.getUpdateCount() return the number of rows updated by DML statements. For all other types of statements, including queries, they return -1."


Modes

Snap Settings


LabelRequired. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the pipeline.
SQL Statements

Required. Provide the queries to be executed by the Snap. End each query with a semi-colon, except the last query. To add another query, click the + to add a row and there add the query. 

Default value: None

Note
titleUsing Where Clauses

Valid JSON paths that are defined in the WHERE clause for queries/statements are substituted with values from an incoming document. If the error view is enabled, documents are written to the error view if the document is missing a value to be substituted into the query/statement. 

Multiexcerpt include macro
nameME_DB_Snaps_Query_Examples
pageOracle - Update

Warning
titleSingle quotes in values must be escaped

Any relational database (RDBMS) treats single quotes (') as special symbols. So, single quotes in the data or values passed through a DML query may cause the Snap to fail when the query is executed. Ensure that you pass two consecutive single quotes in place of one within these values to escape the single quote through these queries.

For example:

If String To pass this valueUse
Has no single quotes
Schaum Series
'Schaum Series'
Contains single quotes
O'Reilly's Publication
'O''Reilly''s Publication'



Session auto-commit

Select this to enable the session's auto-commit. This is useful when using DDL queries since the changes made by such queries cannot be rolled back if the Snap/pipeline fails. If deselected, changes made by DML queries can be rolled back or changes made by DML queries after a DDL queries can be rolled back.

Default value: Selected

Use Result Query

This property enables displaying the result set in output view.

  • Select the checkbox if you want to display the result set in the output.
  • Leave it cleared if you do not want the result set in the output.
Manage Queued Queries

Select this property to decide whether the Snap should continue or cancel the execution of the queued Snowflake Execute SQL queries when you stop the pipeline.

Note

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. Snowflake internally determines which queries are safe to be cancelled and cancels those queries.

Default value: Continue to execute queued queries when pipeline is stopped or if it fails

Multiexcerpt include macro
nameSnap Execution
pageSOAP Execute

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute


Insert excerpt
Snowflake Snap Pack
Snowflake Snap Pack
nopaneltrue