Ziggy - Beta Help

SQL

This Block lets you process SQL queries in a friendly and convenient manner.

Database Type

CLick on the dropdown to specify the database being used.

Connection

Specify the Connection you have defined, which contains the configuration options and Development/Production configurations.

SELECT - Batch Read

The following example shows the SQL Block being used with Batching to read 100 records at a time from a Postgres database.

SQL Block

Output response to edge

You will check this for SELECT type queries where the returned data should be placed on the output edge.

Pass errors to 2nd edge

Check this to reveal a second handle that let's you define a separate Flow path for failed queries.

Batching

If you are reading from a database table that contains large amounts of data, you will want to break this down into batches. This ensure memory usage remains within sensible bounds and is also sensitive to subsequent Blocks that may have size limitations.

  • Check the Process in batches checkbox.

  • Specify the maximum number of records in each batch loop.

  • Be sure to place a Batch End Block downstream in the Flow as the loop back point.

  • Note the use of BATCH ## in the query for SELECT statements.

Batched SELECT Queries

A SELECT query will look like this.

SELECT * FROM customers BATCH ##

BATCH ## will be replaced with LIMIT and OFFSET statements for each batch loop (if applicable).

INSERT queries

In order to process all the elements on the input edge, you can perform a single INSERT INTO operation for the entire array by enclosing the key values in square brackets.

INSERT INTO company (id, name, vat, zip) VALUES [hs_object_id, name, vat, zip]
23 April 2025