Translation reference to convert import MLoad to Snowflake SQL
Description
The IMPORT command specifies a source for data input.
For more information regarding Import MLoad, check here
Sample Source Patterns
As BTEQ content also MLoad is relocated in an EXECUTE IMMEDIATE block. Import transformation with take each layout field an added to a select. Inserts in dml label will be transform to COPY INTO and upserts (Update and insert) will be transform to MERGE INTO.
EXECUTE IMMEDIATE$$DECLARE STATUS_OBJECT OBJECT := OBJECT_CONSTRUCT('SQLCODE', 0);BEGIN-- Additional Params: -q SnowScript/*.LOGTABLE my_table_log;*/--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. **/*.LOGON my_teradata_system/username,password;*/--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. **/*BEGIN IMPORT MLOAD TABLES my_table WORKTABLES my_table_work*/--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. ** /*** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '7' COLUMN '1' OF THE SOURCE CODE STARTING AT 'ERRORTABLES'. EXPECTED 'STATEMENT' GRAMMAR. LAST MATCHING TOKEN WAS 'my_table_err' ON LINE '7' COLUMN '13'. CODE '81'. ***/
/*--ERRORTABLES my_table_err*//*.LAYOUT my_layout;*/ --** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. INFORMATION MAY BE USED IN A TRANSFORMED IMPORT CLAUSE **
/*.dml label insert_into_my_table IGNORE DUPLICATE INSERT ROWS ;*/ --** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. INFORMATION MAY BE USED IN A TRANSFORMED IMPORT CLAUSE **
BEGINCREATE OR REPLACE STAGE &{stagename}; PUT file://C:\USER\user\my_tr_file_1.tr &{stagename}; COPY INTO my_table ( col1, col2 )FROM (SELECTDISTINCT SUBSTRING($1, 1, 2) col1, SUBSTRING($1, 3, 5) col2FROM @&{stagename}/my_tr_file_1.tr );END;/*.END MLOAD;*/--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. **/*.LOGOFF;*/--** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. **END$$