Ziggy - Services and Product Help

SQL

This Block lets you process SQL queries ina friendly and convenient manner. If you need more control, you can use the Javascript Block to access an NPM module directly.

The following example shows the SQL Block being used with Batching to read 20 records at a time from a Postgres database and create Hubspot records as it loops through the batch.

SQL Block

Database Type

CLick on the dropdown to specify the database being used.

Connection

Specify the Connection you have defined, which contains the configuration options as well as Development/Production alternates.

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

Query

Finally, specify the actual Query you want to execute.

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

Last modified: 10 February 2025