Skip to content

Delete Records (Relational DB) v1.0.2 Help

Deletes records from a relational database table based on specified conditions.

How can I use the Step?

The Step lets you manage relational databases in the Relational DB service. You can use the Step to delete records from a table in a workflow for various use cases, such as data cleanup and maintenance.

How does the Step work?

You specify the database table and provide the filters to construct the SQL query. The Step takes these inputs to execute an SQL DELETE statement against the selected table.

Prerequisites

Before you get started, make sure to meet the following conditions:

  • The Step requires a database table in the Relational DB service.
  • If you want to use an external database, connect it to the Relational DB service first.

How to connect an external database?

To connect an external database to our Relational DB service, follow these steps:

  1. Go to Data > Relational DB and click +Create database.

  2. In the modal window, select the Connect external database checkbox, and enter the following details:

    • Name: Database name. Ensure it matches the name of the external database you want to connect.
    • Host: Machine or server of the external database location.
    • Port: Network port number to establish the connection.
    • Username: User name to authenticate the user.
    • Password: Password to authenticate the user and grant them access to the database.
  3. Click Create. If the connection is successful, the external database appears in the list of all databases in your account.

Database settings

To set up the section, specify the database, schema, and table you want to use:

  • For Database, select a database name from the list provided by the Relational DB service or input one using the Merge field. If you use the Merge field, the options to choose an internal or an external database appear - make sure to select an appropriate one.
  • For Schema, select the schema name containing the table.
  • For Table, select the table name where you want to insert new record(s).

Query settings

The Step deletes records that satisfy the filters you provide. These filters serve as the equivalent of the SQL WHERE clause. If you don't enter any filters or leave all filters blank, the Step deletes all records in the table specified.

To delete specific records from the table, follow these steps:

  1. Click +Add a new filter, and provide at least one condition. For each condition, you can specify:

    • Column: The column name on which you want to apply a condition.
    • Operator: An operator that defines how to compare the column value with the value specified.
    • Value: A value you want to compare with the column value.
  2. Optional: Enable Log query to add query information to the session log.

Caution: If entering the condition operator via the Merge field, we don't recommend using in, is null, and is not null options.

Merge field settings

The Step returns the result as a JSON object and stores it in the Merge field variable. So you can use the retrieved data in subsequent Steps or other Flows.

Output example

The output contains information about the number of records (rows) that the Step has deleted from the table. For example:

json
{
    "rowCount": 1
}
{
    "rowCount": 1
}

Error handling

By default, the Handle error toggle is on, and the Step handles errors with a separate exit. If any error occurs during the Step execution, the Flow proceeds down the error exit.

If the Handle error toggle is disabled, the Step does not handle errors. In this case, if any error occurs during the Step execution, the Flow fails immediately after exceeding the Flow timeout. To prevent the Flow from being suspended and continue handling errors, you can place the Flow Error Handling Step before the main logic or your Flow.

Reporting

After the Step completes, it generates a report that includes its execution status and other details. You can customize the report by adjusting the Step's log level and adding tags.

Log level

By default, the Step's log level matches that of the Flow. You can change the Step's log level by selecting an appropriate option from the Log level dropdown.

Tags

Tags provide a way to classify and search for sessions based on their attributes. To create a new tag, specify its category, label, and value. You can then use tags to filter and group the sessions in the report.

Service dependencies

  • flow builder v2.34.0
  • postgresql v2.4.0

Release notes

v1.0.2

  • Add an external database selection for Database

v1.0.0

  • Initial release