First Query
Example 1: Select First
In this example, we'll use the MySQL Execute function with the Type set to First
to get data from MySQL. The statement is expected to return one value; otherwise, it returns an error.
Add MySQL Execute Function
Start by adding the MySQL Execute function. Give it a Result Name and set the Type to First
.
Write the SQL Query
In the function configuration, write the SQL query you want to use to fetch data.
Assume we have a users
table and want to fetch one user by id. The users
table schema looks like this:
Now write the following query:
Map Struct Fields to SQL Query
Because we only selected one field from the database, we don't need to map fields. Just provide an empty List[string]
value.
Testing
Once you’ve configured everything, if the result exists, it will be available in the Data
field.
In case the data not found, it return an error