PostgreSQL Multi Execute

Executes one or more SQL write statements sequentially inside a single transaction.

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.

Note:
  • 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.


Known issues

  • SELECT statements are not supported.

Snap views

Type Description Examples of upstream and downstream Snaps
Input
  • Each input document should contain the data needed for variable substitution in your SQL statements.
  • When using multiple input documents, data can be written to both the output and error views.
  • Executes multiple write statements as a single transaction for every input document.
Output One output document per input document, regardless of the SQL statements executed.
Learn more about Error handling.

Snap settings

Note: Learn about the common controls in the Snap settings dialog.
Field/Field set Type Description
Label

String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: PostgreSQL - Multi Execute

Example: PostgreSQL - Multi Execute
SQL Statements Required. Define the list of SQL statements to be executed as a single transaction.
SQL statement

String/Expression

Required. Specify the SQL statement to execute on the server.

Default value: N/A

Example:

  • drop table if exists public.snap_count1
  • create table public.snap_count1 (id int, name varchar(20))
  • insert into public.snap_count1 values (100, 'Jane')
Snap Execution

Dropdown list

Choose 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.

Default value: Execute only

Example: Validate & Execute