SSC-EWI-TD0001

Recursive forward alias error.

Some parts in the output code are omitted for clarity reasons.

Severity

Low

Description

This EWI is shown whenever SnowConvert detects recursion within aliased expressions, therefore being unable to execute the Forward Alias transformation required for the correct functionality of aliases within Snowflake environment.

A recursive alias happens when an aliased expression contains another alias, and the second aliased expression contains the first alias. This may not be as trivial as the example shows, since the recursion can happen further down the line in a transitive way.

Example Code

Note: Recursive aliases are not supported in Snowflake, however, some simple instances are.

Note that recursive alias is not supported in Snowflake, however, some simple instances are. Check the examples below.

The following example code works in Snowflake after migration:

Teradata:

IN -> Teradata_01.sql
SELECT
    COL1 AS COL2,
    COL2 AS COL1
FROM
    TABLE_EXAMPLE;

Snowflake Scripting:

OUT -> Teradata_01.sql
// SnowConvert Helpers Code section is omitted.
SELECT
    COL1 AS COL2,
    !!!RESOLVE EWI!!! /*** SSC-EWI-TD0001 - 'COL1' HAS RECURSIVE REFERENCES. FORWARD ALIAS CONVERSION COULD NOT BE COMPLETED ***/!!!
    COL2 AS COL1
FROM
    TABLE_EXAMPLE;

However, the following example code does not work:

Teradata:

IN -> Teradata_02.sql
SELECT
    A + B as C,
    COL2 + C AS A,
    COL3 AS B
FROM
    TABLE_EXAMPLE;

Snowflake Scripting:

OUT -> Teradata_02.sql
// SnowConvert Helpers Code section is omitted.
SELECT
    !!!RESOLVE EWI!!! /*** SSC-EWI-TD0001 - 'A' HAS RECURSIVE REFERENCES. FORWARD ALIAS CONVERSION COULD NOT BE COMPLETED ***/!!!
    COL2 + C AS A,
    COL3 AS B,
    A + B as C
FROM
    TABLE_EXAMPLE;

Recommendations

  • Review your code and make sure recursive forward aliases are not present. The EWI shows the name of the first instance of an alias that has recursive references, but that does not mean that is the only one that has them in your code.

  • If you need more support, you can email us at snowconvert-support@snowflake.com

Last updated