Snowflake Data Cloud Connector > Part III: SQL ELT with Snowflake Data Cloud Connector > SQL ELT optimization for mapping tasks > Transformations with Snowflake Data Cloud
  

Transformations with Snowflake Data Cloud

When you configure SQL ELT optimization, Data Integration tries to push the configured transformation to Snowflake.
You can use full SQL ELT to push the following transformations to Snowflake:
*Doesn't apply to mappings in advanced mode.
Note: Router transformation is applicable only for source SQL ELT and Hierarchy Processor transformation is applicable only to mappings in advanced mode.
For more information about configuring transformations, see Transformations.

Aggregator transformation

You can configure full SQL ELT optimization to push an Aggregator transformation to process in Snowflake.

Aggregate calculations

You can perform the following aggregate calculations:

Incoming ports

When you configure an Aggregator transformation and the incoming port is not used in an aggregate function or in a group by field in mappings, the ANY_VALUE() function is used for columns that are not part of the group by or the aggregator function. In this case, the output is not deterministic as the ANY_VALUE() function returns any value from the port. However, in advanced mode, when the incoming port is not a part of the group by field, the MAX() function is used. The Aggregator transformation also generates an additional column with value as 1. However, this column is dropped and not used in the insert part of the SQL ELT query.

Expression transformation

You can configure full SQL ELT optimization to push an Expression transformation to process in Snowflake.
You can add an Expression transformation to each of the sources in the mapping, followed by a join downstream in the mapping. Additionally, you can add multiple Expression transformations that branch out from a transformation and then branch in into a transformation downstream in the mapping.
When you configure an Expression transformation, consider the following rules to include variables in the expression:

Hierarchy Processor transformation

In advanced mode, you can configure a Hierarchy Processor transformation to read hierarchical or relational input from the Amazon S3 V2 or Microsoft Azure Data Lake Storage Gen2 source and write as relational or hierarchical output to the Snowflake target.
The Hierarchy Processor transformation processes hierarchical fields that represent a struct or an array.
You can configure a Hierarchy Processor transformation with the following restrictions:

Lookup transformation

You can configure full SQL ELT optimization to push a Lookup transformation to process in Snowflake. You can push both a connected and an unconnected lookup.
When the mapping contains an unconnected lookup, you can also nest the unconnected lookup function with other expression functions. For example, :LKP.U_LOOKUP(Upper(argument1), argument)

Lookup objects

Consider the following rules when you configure lookups:

Connected lookup

In a mapping with a Snowflake Data Cloud source and target, set the Multiple Matches option for the lookup object to Return all rows.

Unconnected lookup

When you configure an unconnected Lookup transformation, consider the following rules:

Multiple matches behavior in a connected and unconnected lookup

If you enable SQL ELT optimization for a mapping that contains a connected or unconnected lookup, you must follow these guidelines:

FileName port

When you configure a lookup for an Amazon S3 source in a mapping that contains an Amazon S3 source and Snowflake target, remove the filename port from both the Amazon S3 source and lookup object. The FileName port is not applicable.

Lookup query object

When you use a lookup object as a query in a Lookup transformation in a mapping to lookup data in Snowflake, specify the database and schema in the advanced lookup properties or in the additional JDBC URL parameters in the Snowflake Data Cloud connection.

Normalizer transformation

You can configure a Normalizer transformation in a mapping to return a row for each instance of the multiple-occurring data.
For example, a relational source includes four fields with quarterly sales data. You can configure a Normalizer transformation to generate a separate output row for each quarter.
In advanced mode, you can configure a Normalizer transformation with the following restrictions:

Router transformation

You can configure source SQL ELT optimization to push a Router transformation to the database for processing.
When you configure a Router transformation, connect or map only one output group to the target transformation.

Sequence Generator transformation

When you configure a Sequence Generator transformation, you can connect the NEXTVAL port to single or multiple ports in the transformations that follow the Sequence Generator transformation.
You can push a Sequence Generator transformation with the following restrictions:

Guidelines for using a Sequence Generator transformation in mappings in advanced mode and SQL ELT mode

A Sequence Generator transformation in advanced mode and SQL ELT mode follows the same rules as in mappings. However, to use a Sequence Generator transformation in a mapping in advanced mode and SQL ELT mode, you need to additionally set a property in the mapping task properties, with the name of the sequence in Snowflake.
  1. 1On the Runtime Options tab in the task properties, navigate to the Advanced Session Properties section.
  2. 2Add a custom property and enter the following session property value in the following format:
  3. Pushdown.<Sequence transformation name in mapping>.SequenceName=<sequence name to create in Snowflake>
  4. For example,
  5. Pushdown.Seq_SF.SequenceName=snowflake_first_sequence&:Pushdown.sequence_second.SequenceName=SECOND_SEQUENCE&:Pushdown.seq_third.SequenceName=THIRD_SEQ
When you use multiple Sequence Generator transformations, the name of the sequence object to be created in the Snowflake database for each sequence must be unique. If not, the transformation runs with the CREATE SEQUENCE IF NOT EXISTS query twice using the same name. The first sequence runs as expected, but the second sequence which has the same name as the first sequence does not override it. Hence, the nextValue generated for the second sequence is incorrect. However, when the sequence runs with a unique name for the sequence object, that sequence is not updated again, irrespective of the number of times you run the mapping.
Note: If you disable SQL ELT optimization and run the mapping, the sequence values restart from the initial start value. If you delete a mapping, you must ensure to also drop the sequences from the Snowflake database.

SQL transformation

You can use an SQL transformation only to push certain functions and shared sequence.

Use functions to run queries

You can include functions in an entered query in an SQL transformation and run queries with the Snowflake target endpoint.
You must use only the SELECT clause SQL statement to push a function. Specify the column name in the select query or function. Do not push functions using statements such as "SELECT * FROM TABLE".
You can use the following functions in an entered query:
To use the CURRENT_ROLE, CURRENT_DATABASE, and CURRENT_SCHEMA functions in an SQL transformation, ensure to provide the database, role, and schema name in the additional JDBC parameters field in the Snowflake Data Cloud connection. If you do not specify the values in the connection, Data Integration inserts null to the target.

Reuse shared sequence

You can push a mapping with a shared sequence defined in an SQL transformation to a Snowflake endpoint. Data Integration writes the data in the same sequence to the target as in the Snowflake source.
Get the shared sequence from Snowflake and define the sequence in an entered query in an SQL transformation.
Specify the shared sequence in the entered query in the following syntax: Select <Snowflake_schema_name>.<Snowflake_database_name>.<sequence_name>.NEXTVAL

User defined functions

You can configure a custom query in an SQL transformation to read from Java or SQL user-defined functions (UDF) in Snowflake.
The following guidelines apply for UDFs:

Union transformation

You can push a Union transformation with the following restrictions:

Update Strategy transformation

You cannot use an Update Strategy transformation.
You can instead use the update and upsert operations in the Target transformation to write to Snowflake.