Skip to content

Select Records (Relational DB) v1.0.2 Help

Selects 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 retrieve records from a table in a workflow for various use cases such as data analysis and reporting.

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 SELECT 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 sets records that satisfy the filters you provide. If you don't enter any filters or leave all filters blank, the Step selects all records in the table specified.

To retrieve 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 enter operator via Merge field, we don't recommend using in, is null, and is not null options.

Output settings

To customize the output of the selected records, you can use the following settings:

  • Sort: The column name by which you want to sort the selected records. By default, sorting is not applied.
  • Sort direction: Sort direction, either ascending or descending.
  • Offset: Number of records to skip before starting to return records. Input value must be an integer greater or equal to zero. Defaults to zero.
  • Limit: The maximum number of records to return. Input value must be an integer greater or equal to zero. By default, the limit is not applied.

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 Step returns an array of objects, where each object corresponds to the selected record. For example, if you specify options to select two records from a table, the output might look like this:

json
[
    {
        "id": 1001,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@test.com",
    },
    {
        "id": 1002,
        "first_name": "Mary",
        "last_name": "Smith",
        "email": "mary.smith@test.com",
    }
]
[
    {
        "id": 1001,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@test.com",
    },
    {
        "id": 1002,
        "first_name": "Mary",
        "last_name": "Smith",
        "email": "mary.smith@test.com",
    }
]

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