Preprocess tasks

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Description

These tasks are executed before the SnowConvert migration. This can be useful to improve the parsing process.

Split Task

This task splits the input code top-level objects into multiple files. The containing folders would be organized following the next hierarchy:

└───A new folder named ''[input_folder_name]_Processed''
    └───Top-level object type
        └───Schema name

Example

Input

├───in
│       DDL_Macros.sql
│       DDL_Procedures.sql
│       DDL_Tables.sql

Output

Assume that the name of the files is the name of the top-level objects in the input files.


├───in_Processed
    ├───macro
    │   └───MY_DATABASE
    │           MY_FIRST_MACRO.sql
    │           ANOTHER_MACRO.sql

    ├───procedure
    │   └───MY_DATABASE
    │           A_PROCEDURE.sql
    │           ANOTHER_PROCEDURE.sql
    │           YET_ANOTHER_PROCEDURE.sql

    └───table
        └───MY_DATABASE
                MY_TABLE.sql
                ADDITIONAL_TABLE.sql
                THIRD_TABLE.sql

Inside the "schema/database name" folder, should be as many files as top-level objects in the input code. Also, it is possible to have copies of some files when multiple same-type top-level objects have the same name. In this case, the file names will be enumerated in ascending order.

Only files with the ".sql", ".ddl" and ".dml" extensions will be considered for splitting. Other kinds of files like ".bteq" scripts will be copied into the preprocessed folder and will be categorized depending on the script extension but they won't be modified by the Split Task.

Requirements

In order to identify the top-level objects, they need a tag in a comment before the declaration.

The tag should follow the next format:

<sc-top_level_object_type>top_level_object_name</sc-top_level_object_type>

You can follow the next example:

/* <sc-table> MY_DATABASE.MY_TABLE</sc-table> */
CREATE TABLE "MY_DATABASE"."MY_TABLE" (
    "MY_COLUMN" INTEGER
) ;

Last updated