PostgreSQL Multi Execute
In this article
Overview
You can use this Snap to execute one or more SQL write statements sequentially inside a single transaction (BEGIN/END) for each input document. If one statement fails, all statements in that transaction are rolled back.
If an SQL statement fails, subsequent SQL statements are not executed, and error output is passed to the error view (if you select the option Route Error Data to Error View).
If all statements are successful, all output results are passed to the output view.
Snap Type
The PostgreSQL - Multi Execute Snap is a Write-type Snap.
Support for Ultra Pipelines
Works in Ultra Tasks.
Known Issues
SELECT statements are not supported.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
|---|---|---|---|---|
Input | Document
|
|
| |
Output | Document
|
|
| |
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 when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab:
Learn more about Error handling in Pipelines. | |||
Snap Settings
Expression : JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
SnapGPT : Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
Suggestion : Populates a list of values dynamically based on your Account configuration.
Upload : Uploads files. Learn more.
Learn more about the icons in the Snap Settings dialog.
Field Name | Field Type | Description |
|---|---|---|
Label*
| 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* | Define the list of SQL statements to be executed as a single transaction. | |
SQL statement*
| String/Expression | Specify the SQL statement to execute on the server.
|
Snap Execution
| Dropdown list | Select one of the following three modes in which the Snap executes:
Default Value: Execute only |
Example
Execute multiple statements using PostgreSQL Multi Execute Snap
This pipeline performs database table management operations on a PostgreSQL database. It executes multiple SQL statements in a sequence—it drops an existing table if it exists, creates a new table with specific schema, and inserts initial data into the newly created table.
Configure the PostgreSQL - Multi Execute Snap with the following SQL Statements:
drop table if exists public.snap_count1: Drops the tablepublic.snap_count1if it exists.create table public.snap_count1 (id int, name varchar(20)): Creates a new table with columnsidandname.insert into public.snap_count1 values (100, 'Jane'): Inserts a record with values into the newly created table.
On validation, the pipeline executes the three SQL statements and displays the three SQL operations:
Drop Table Result - Status of dropping the existing 'public.snap_count1' table (if it existed) (
success)Create Table Result - Status of creating the new 'public.snap_count1' table with 'id' and 'name' columns. Count for each SQL statement
Insert Data Result - Status of inserting the initial record into the newly created table
After successful execution, you'll have:
A new PostgreSQL table named
public.snap_count1The table will contain the initial data record that was inserted.
The table will have the defined
idandnamenames.
Downloads
Download and import the pipeline into the SnapLogic application.
Configure Snap accounts, as applicable.
Provide pipeline parameters, as applicable.
Snap Pack History
Related Content
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438096
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438884
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438860
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/3153789126
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2025 SnapLogic, Inc.