Snowflake Insert

Use this activity to execute an SQL Insert statement on a Snowflake tenant. The Snowflake Insert activity returns information in the form of rows.

Configuration

The Configuration tab has the following fields:

Field Description
Connection Name of the connection.

Input Settings

The Input Settings tab has the following fields:

Field Description
Query

An SQL statement used to insert a record in the table. You can construct prepared SQL queries by using substitution variables (or parameters) of the form ?<fieldname> in the insert query statement.

Each substitution variable identifies an input parameter whose mapped value is substituted into the substitution variable at runtime. You can reuse the substitution variable for the same input parameter elsewhere in the query. The type information for the input parameters used in the VALUES clause, is fetched from the database using the selected connection for the entered insert query. Similarly, input fields in the Input tab of the activity are also populated based on the SQL Insert statement. You must include a semicolon (;) at the end of the query. This activity expects an insert query to end with a semicolon to indicate the end of the query. A missing semicolon results in the query hanging. The following example represents a typical insert query:
INSERT INTO employee (name, salary) VALUES ('test1', ?salary);
For the above insert query, input field is generated for salary (NUMERIC) and name (TEXT) under Values[] node as a part of values clause.
INSERT INTO products (product_no, name, price) VALUES (?product_no, ?name, ?price) ;

For the above insert query, input fields are generated for product_no (INTEGER), name (TEXT), and price (NUMERIC). The mapped value for the field product_no, name, price is substituted into the substitution variables ?product_no , ? name , ?price. The parameters node in the Input tab do not have mappings as there is no parameter in the insert query statement.

It is also possible to enter multi-row queries. For example, INSERT INTO student (roll_no, name, marks) VALUES (1,'Student1', 99), (2, 'Student2', 80), (3, 'Student3', 75). Value substitution variables can also be used in multi-row values. For example, INSERT INTO products VALUES (1,'Student1', ?marks), (2, 'Student2', ?marks), (3, 'Student3', ?marks). If multi-row values are used, it is important to note the following points:
  • A value substitution variable must appear in all the rows at the same position. You cannot have some rows with the value variable and other rows without it.
  • If the value row is mapped to the output values from previous activities, then the output data from the previous activity must contain the same number of records as there are rows entered in the insert query definition.
Fields This grid is provided for informational purpose only.

Input

The Input tab contains the input schema in a tree structure format. The fields that were selected in the Input Settings tab will be available in the schema. You can either hard code their values or map them to a field from the output of a preceding activity in the flow using the Mapper.

Output

The Output tab displays the output schema of the activity as a tree structure. The output is read-only. The information in the schema varies based on the fields selected on the Configuration tab. The properties that are displayed in the schema correspond to the output of this activity and can be used as input by subsequent activities in the flow.