Wait for SQL

Description

The Wait for SQL action scans a database and checks if the database meets user-defined conditions.

Options

Option Description

Action name

The name of the workflow action.

Connection

Identifies the database connection to use.

Target schema

Name of the table schema to evaluate.

Target table

Name of the table to evaluate.

Success condition

Success when rows count

Defines the evaluation method used to compare the number of rows with the given value. The options are:

  • Equal to

  • Different from

  • Smaller than

  • Smaller or equal to

  • Greater than (default)

  • Greater or equal to

Row count value

Defines the row count value used for the evaluation

Maximum timeout

After this timeout period, the workflow action continues with a fail, by default, or success, if the Success on timeout option is checked. Expressed in seconds, 0 is infinite.

Check cycle time

Sets the amount of time between evaluations, expressed in seconds.

Success on timeout

Defines workflow action success behavior when timeout is reached---when checked, reaching the maximum timeout limit causes the workflow action to succeed. When left unchecked, reaching the maximum timeout limit causes the workflow action to fail.

Custom SQL

Custom SQL

Enables the use of custom SQL queries.

Use variable substitution

Replaces environment variables in the SQL script with their actual value.

Clear list of result rows before execution

Clears the list of result rows before running this workflow action.

Add rows to result

Includes returned rows to the result set.

SQL Script

The custom SQL script to use when the Custom SQL option is enabled.

Result

What this action passes on to the next action. See Action results for how results travel through a workflow.

Result Value

True

The condition is met before Maximum timeout, or the timeout is reached while Success on timeout is checked. The number of errors is 0.

False

The timeout is reached while Success on timeout is unchecked, the connection is empty, unknown or can’t be opened, Target table is empty (without Custom SQL), or SQL Script is empty (with Custom SQL). The number of errors is 1.

Result files

Passed on unchanged.

Result rows

Without Custom SQL: passed on unchanged. With Custom SQL: Clear list of result rows before execution removes the previous result rows when the action starts, also when the condition is never met. Add rows to result adds the rows the query returns only when the condition is met.

A query that fails, for example on a table that doesn’t exist, counts as a condition that is not met: the action logs the error and keeps checking until Maximum timeout. With the default Maximum timeout of 0, it keeps checking forever.
With Custom SQL, the action counts the rows the query returns, not a value in them: SELECT count(*) FROM my_table returns 1 row, also when the table is empty.