Prerequisites
In this article you'll learn:
Like most nodes, the Snowflake node is divided into two areas. The main area on the left is for writing your query and configuring the node and the Preview box on the right lets you test the node with test input data and shows you what the node returns.
First, let's look at the config area on the left.
If you haven't done so, create a Snowflake authentication in FactBranch.
In the Snowflake node, select the "Authentication" tab and select the authentication you've just created.
Write your SQL query in the large area on the left where you can also use placeholders in the query. See the section using placeholders below for more info.
In order for placeholders to be substituted with real data, we first need to define some test data. So let's look at the Preview box on the right.
Most nodes use dynamic data somewhere (more on using placeholders for dynamic data in the next section below) and so it's essential to try out your node with input data.
The Input data is displayed as individual editable fields in the Preview box. When you have a previous node in your flow, the output data from that node automatically appears as the test input data for the current node. You can edit each field value individually to test different scenarios.
If this is the first node in your flow (connected directly to a trigger), the test input data will be populated with the data captured from your trigger.
To dynamically insert data in your SQL query, you can use placeholders. They beginn with a dollar-sign ($) just like variables in many programming languages.
The input data to this node are stored in the $data
variable. Let's say your
node receives the following data:
{
"id": 123,
"email": "alice@example.com",
"name": "Alice"
}
And let's say you want to use the email parameter in the WHERE clause of your query. You could have the email inserted dynamically like this:
SELECT * FROM myschema.customer
WHERE email=$data.email
The value will be inserted at runtime and will be SQL-escaped in order to prevent SQL-injection issues.
If you need to use the dollar-sign ($
) somewhere in your query other than in a
placeholder, please use the escaped version which is two dollar-signs ($$
).
To see the effects of your query, hit the Run button. This will run the node (but only this single node) for real. So if you're updating data in your query, your real data will update.
In the test run it will replace all placeholders with the data you've defined in Input data.
After the request finishes, you'll see the outputs in the Output section. This is whatever the Snowflake warehouse returns and you can work with this data in the next node.
If this is already the final node in the Flow, this output will be returned as the Flow's results.
To rename the node, either click on Rename next to the title, or double-click on the title itself. Then enter the new name and click on Save or hit Enter on your keyboard. To revert to the old name, hit the Escape key.
Above the Input box you find the quick navigation through the Flow. Use this to get to the previous or the next node.