Command Line Interface

Execute SnowConvert via CLI

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

Quick start

To execute a conversion with the SnowConvert CLI you have to have an active access code. Currently, the access codes for the CLI are different than the UI, but if you already have an access code for the UI you should be able to reuse the same access code. In the section below we show how to install an access code.

There are several Command Line Arguments documented below, but the main ones are -i for the input folder and -o for the output folder.

Install an access code

To install an access code just execute SnowConvert CLI program with the install-ac argument and the access code.

$: snowct install-ac --access-code <access-code>

CLI useful commands

  • snowct --help or snowct -h: Will show help.

  • snowct --version or snowct -v: Will show the version of the CLI (and the code processors).

  • snowct install-ac --access-code <access-code>: Will install the corresponding access code provided.

  • snowct install-ac --file <file-with-access-code>: Will install the corresponding access code in the machine (using an access code file).

  • snowct show-ac --platform <platform>: Will show the active access code for a specific platform (Oracle, Teradata, SQL-server, scala, python).

  • snowct {Language} -i ./input -o ./output: Will convert the input code.

    • Supported Languages: Teradata, Oracle, SQL-server.

  • snowct {Language} -i ./input -o ./output --assessment: Will perform an assessment of the input code.

  • You can check the help for a specific command just by using the -h or --help option. For example:

    • snowct install-ac --help

    • snowct show-ac --help

    • snowct teradata --help

Common CLI Arguments

The following arguments can be used in all the languages

-i, --input <PATH> (Required)

The path to the folder or file containing the input source code.

-o, --output <PATH> (Required)

The path to the output folder where the converted code and reports will be stored.

-a, --assessmentmode

Flag to indicate whether or not to generate only Assessment files. By default, it's set to FALSE.

-t, --PLTargetLanguage <TARGET_LANGUAGE>

String value specifying the target language to convert Stored procedures and Macros. Currently supported are: SnowScript and JavaScript. The default value is set to SnowScript.

-e, --encoding <CODE PAGE>

The encoding code page number is used for parsing the source files. We only accept encodings supported by .NET Core. Here are the ones supported at the moment:

Code Page

Name

Display Name

1200

utf-16

Unicode

1201D

unicodeFFFE

Unicode (Big endian)

12000

utf-32

Unicode (UTF-32)

12001

utf-32BE

Unicode (UTF-32 Big endian)

20127

us-ascii

US-ASCII

28591

iso-8859-1

Western European (ISO)

65000

utf-7

Unicode (UTF-7). Not available in .NET 5

65001

utf-8

Unicode (UTF-8). Default encoding

-s, --customschema <SCHEMA_NAME>

The string value specifies the custom schema name to apply. If not specified, the original database name will be used. Example: DB1.MyCustomSchema.Table1.

-d, --database <DB_NAME>

The string value specifies the custom database name to apply. Example: MyCustomDB.PUBLIC.Table1.

--rate

The string value specifies the conversion rate mode. Currently supported are: LoC (Lines of Code) and Character. The default value is set to LoC.

-m, --comments

Flag to indicate if the user wants to comment on nodes that have missing dependencies.

--useExistingNameQualification

This flag must be used in conjunction with the -d or -s parameters. When used, it preserves the existing name qualification from the input code when previous parameters are used. Let's take a look at this example where -s newSchema was included:

SELECT * FROM mySchema.myObject;

The same applies to databases.

--disableEWIsGeneration

Flag to indicate whether EWIs comments (Errors, Warnings, and Issues) will not be generated on the converted code. The default is false.

--terms

Show access code terms information.

--help

Display the help information.

Teradata CLI arguments

The following CLI arguments are specific for executing migrations with SnowConvert for Teradata

--CharacterToApproximateNumber <NUMBER>

An integer value for the CHARACTER to Approximate Number transformation (Default: 10).

--DefaultDateFormat <STRING>

String value for the Default DATE format (Default: "YYYY/MM/DD").

--DefaultTimeFormat <STRING>

String value for the Default TIME format (Default: "HH:MI:SS").

--DefaultTimestampFormat <STRING>

String value for the Default TIMESTAMP format (Default: "YYYY/MM/DD HH:MI:SS").

--DefaultTimezoneFormat <STRING>

String value for the Default TIMEZONE format (Default: "GMT-5").

-p, --scriptTargetLanguage <TARGET_LANGUAGE>

The string value specifies the target language to convert Bteq and Mload script files. Currently supported values are SnowScript and Python. The default value is set to Python.

--replaceDeleteAllToTruncate

Flag to indicate whether Delete All statements must be replaced with Truncate or not. This will generate MSCEWI2037 when the replacement is done. Example:

Input code:

create table testTable(
    column1 varchar(30)
);

delete testTable all;

delete from testTable;

Output code (argument not specified):

CREATE TABLE PUBLIC.testTable (
column1 varchar(30)
);

DELETE FROM PUBLIC.testTable;

DELETE FROM PUBLIC.testTable ;

Output code (argument specified):

CREATE TABLE PUBLIC.testTable (
column1 varchar(30)
);

TRUNCATE TABLE PUBLIC.testTable /*** MSC-WARNING - MSCEWI2037 - DELETE ALL WAS REPLACED TO TRUNCATE, IT MIGHT BE CHANGED TO DELETE IF ACTIVITY_COUNT IS NEEDED ***/;

DELETE FROM PUBLIC.testTable ;

--generateStoredProcedureTags

Flag to indicate whether the SQL statements SELECT, INSERT, CREATE, DELETE, UPDATE, DROP, MERGE in Stored Procedures will be tagged on the converted code. This feature is used for easy statement identification on the migrated code. Wrapping these statements within these XML-like tags allows for other programs to quickly find and extract them. The decorated code looks like this:

--splitPeriodDatatype

This flag is used to indicate that the tool should migrate any use of the PERIOD datatype as two separate DATETIME fields that will hold the original period begin and end values, anytime a period field or function is migrated using this flag MSCEWI2074 will be added to warn about this change.

Input Code:

CREATE TABLE myTable(
   col1 PERIOD(DATE),
   col2 VARCHAR(50),
   col3 PERIOD(TIMESTAMP)
);

Output Code (argument not specified):

CREATE TABLE PUBLIC.myTable (
   col1 VARCHAR(24) /*** MSC-WARNING - MSCEWI2053 - SNOWFLAKE DOES NOT SUPPORT THE PERIOD DATATYPE, ALL PERIODS ARE HANDLED AS VARCHAR INSTEAD ***/,
   col2 VARCHAR(50),
   col3 VARCHAR(58) /*** MSC-WARNING - MSCEWI2053 - SNOWFLAKE DOES NOT SUPPORT THE PERIOD DATATYPE, ALL PERIODS ARE HANDLED AS VARCHAR INSTEAD ***/
);

Output Code (argument specified):

CREATE TABLE PUBLIC.myTable (
   col1_begin DATE,
   col1_end DATE /*** MSC-WARNING - MSCEWI2074 - PERIOD DATA TYPES ARE HANDLED AS TWO DATA FIELDS ***/,
   col2 VARCHAR(50),
   col3_begin TIMESTAMP,
   col3_end TIMESTAMP /*** MSC-WARNING - MSCEWI2074 - PERIOD DATA TYPES ARE HANDLED AS TWO DATA FIELDS ***/
);

--arrange

Flag to indicate whether the input code should be processed before parsing and transformation.

--RenamingFile

The path to a .json file that specifies new names for certain objects such as Tables, Views, Procedures, Functions, and Macros. This parameter can't be used with the customSchema argument. Navigate to the Renaming Feature page to learn more about this argument.

Learn more about this step on our Processing the code page.

Oracle CLI arguments

--disableSynonym

Flag to indicate whether or not Synonyms should be transformed. By default, it's set to true.

--disablePackagesAsSchemas

Flag to indicate whether or not the Packages should be transformed to new Schemas.

Please check the naming of the procedure enabling and disabling the flag:

// Oracle Input

CREATE OR REPLACE PACKAGE emp_mgmt AS
PROCEDURE remove_emp (employee_id NUMBER );
END emp_mgmt;

CREATE OR REPLACE PACKAGE BODY emp_mgmt AS 
PROCEDURE remove_emp (employee_id NUMBER) IS 
   BEGIN 
      DELETE FROM employees 
      WHERE employees.employee_id = remove_emp.employee_id; 
      tot_emps := tot_emps - 1; 
   END; 
END emp_mgmt; 

// Transformation by default

CREATE SCHEMA IF NOT EXISTS emp_mgmt;
...
CREATE OR REPLACE PROCEDURE emp_mgmt.remove_emp (employee_id FLOAT)
...

// Transformation with disablePackagesAsSchemas flag

CREATE OR REPLACE PROCEDURE EMP_MGMT_REMOVE_EMP (employee_id FLOAT)
...

--outerJoinsToOnlyAnsiSyntax

Flag to indicate whether Outer Joins should be transformed to only ANSI syntax.

--disableDateAsTimestamp

Flag to indicate whether SYSDATE should be transformed into CURRENT_DATE or CURRENT_TIMESTAMP. This will also affect all DATE columns that will be transformed to TIMESTAMP.

// Oracle Input
CREATE TABLE DATE_TABLE(
    DATE_COL DATE
);

SELECT SYSDATE FROM DUAL;

// Transformation by default
CREATE OR REPLACE TABLE PUBLIC.DATE_TABLE (
	DATE_COL TIMESTAMP /*** MSC-WARNING - MSCEWI3060 - DEFAULT VALUE FOR SYSDATE IS CURRENT_TIMESTAMP. COLUMN WAS TRANSFORMED TO TIMESTAMP TO PRESERVE INFORMATION. ***/
);

SELECT
	CURRENT_TIMESTAMP
FROM DUAL;

// Transformation with --disableDateAsTimestamp flag
CREATE OR REPLACE TABLE PUBLIC.DATE_TABLE (
	DATE_COL DATE
);

SELECT
	CURRENT_DATE
FROM DUAL;

Learn more about how you can get access to the SnowConvert for Oracle Command Line Interface tool by filling out the form on our Snowflake Migrations Info page.

--arrange

Flag to indicate whether the input code should be processed before parsing and transformation.

Learn more about this step on our Processing the code page.

SQL Server CLI arguments

-u, --usedatabase

Flag to indicate whether or not the Transact SQL USE statement should be translated.

-p, --arrange <ARRANGE OPTION> [<ARRANGE OPTION>]

Flag to indicate whether or not to preprocess or arrange the source code before its transformation. By default, it's set to FALSE.

prettyprint

Applies indentation to the original code and get it well organized.

generatereports

Generates extra reports after the arrangement.

multiple

Applies arrangement to multiple databases represented as multiple folders, and keeps their original structure.

Last updated