Scripting languages support

Brief summary of how the scripting languages are being handled.

Procedure queries

The procedure body is treated as an extension of the source file, this is to get information over objects inside it. For example, when the analyzer found occurrences of dependencies inside the body they are registered from the procedure to the object.

Procedure language support:

E.g.:

CREATE OR REPLACE PROCEDURE PROC1() 
RETURNS STRING 
LANGUAGE JAVASCRIPT AS
$$
{
   UPDATE DB.SCH.T1 SET value1 = newValue
}
$$;

(PROC1)−REFERENCES→(DB.SCH.T1)

Unsupported syntax

The analyzer will not get references from SQL statements created dynamically. Even if the variable is filled in the same code.

create or replace procedure get_row_count(TABLE_NAME VARCHAR)
    returns float 
    not null
    language javascript
    as
    $$
    // Dynamically compose the SQL statement to execute.
    var sql_command = "select count(*) from " + TABLE_NAME;
    // Run the statement.
    var stmt = snowflake.createStatement(
           {
           sqlText: sql_command
           }
        );
    //... more code
    $$
    ;

Last updated