SnowConvert AI - Teradata - FLOAD¶
Translation references to convert Teradata FLOAD files to Python
Teradata FastLoad is a command‑driven utility for quickly loading large amounts of data in an empty table on a Teradata Database.
To simulate the FastLoad functionality for Teradata in Snowflake, FastLoad files and commands are transformed to Python code, similar to the transformations performed for BTEQ and MultiLoad scripts. The generated code uses the Snowflake Python project called snowconvert.helpers which contains the required functions to simulate the FastLoad statements in Snowflake.
FastLoad Commands Translation¶
Most of the FastLoad commands are considered not relevant in Snowflake, these commands are commented out. Below is the summary list of FastLoad commands and their transformation status into Snowflake:
| Teradata FastLoad Command | Transformation Status | Note |
|---|---|---|
| AXSMOD | Commented | |
| BEGIN LOADING | Transformed | The node is commented out since the transformation occurs in the related INSERT statement instead. |
| CLEAR | Commented | |
| DATEFORM | Commented | |
| DEFINE | Transformed | |
| END LOADING | Transformed | Commented out since is not necessary for the transformation of the BEGIN LOADING. |
| ERRLIMIT | Commented | |
| HELP | Commented | |
| HELP TABLE | Commented | |
| INSERT | Transformed | Transformed as part of the BEGIN LOADING. |
| LOGDATA | Commented | |
| LOGMECH | Commented | |
| LOGOFF | Commented | |
| LOGON | Commented | |
| NOTIFY | Commented | |
| OS | Commented | |
| QUIT | Commented | |
| RECORD | Commented | |
| RUN | Commented | |
| SESSIONS | Commented | |
| SET RECORD | Transformed | |
| SET SESSION CHARSET | Commented | |
| SHOW | Commented | |
| SHOW VERSIONS | Commented | |
| SLEEP | Commented | |
| TENACITY | Commented | |
Default Transformation¶
The default behavior of the ConversionTool for these statements is to comment them out. For example:
Teradata (FastLoad)
Snowflake (Python)
Nonetheless, there are some exceptions that must be converted to specific Python statements to work as intended in Snowflake.
BEGIN LOADING (And related commands)¶
The transformation for the command BEGIN LOADING is a multi-part transformation that requires the DEFINE, INSERT and (optionally) SET RECORD commands to simulate its behavior correctly.
This transformation is fully explained in this section.
SET RECORD¶
As stated above, this command is not required for the transformation of the BEGIN LOADING. If not found, the default delimiter will be set to ‘,’ (comma). Else, the defined delimiter will be used.
Teradata (FastLoad)
Snowflake (Python)
In the example above, FastTable is the name of the table associated to the BEGIN LOADING command. Note the use of the python variableinputDataPlaceholder, that must be defined by the user in a previous step. The value represents the Snowflake stage that could be internal or external as shown in the following table or as explained here.
| Stage | Input Data Place Holder |
|---|---|
| Stage | Input Data Place Holder |
| Internal stage | @my_int_stage |
| External stage | @my_int_stage/path/file.csv |
| Amazon S3 bucket | s3://mybucket/data/files |
| Google Cloud Storage | gcs://mybucket/data/files |
| Microsoft Azure | |
Embedded SQL¶
FastLoad scripts support Teradata statements inside the same file. The majority of these statements are converted just as if they were inside a BTEQ file, with some exceptions.
Dropping an error table is commented out if inside a FastLoad file.
Teradata (FastLoad)
Snowflake (Python)
Large Example¶
Given the transformations shown above for a variety of commands, consider the following example.
Teradata (FastLoad)
Snowflake (Python)
If you have any additional questions regarding this documentation, you can email us at snowconvert-support@snowflake.com.
Known Issues¶
No issues were found.
Related EWIs¶
- SSC-FDM-0007: Element with missing dependencies.
- SSC-FDM-0027: Removed next statement, not applicable in Snowflake.
BEGIN LOADING¶
The transformation for the command BEGIN LOADING is a multi-part transformation that requires the DEFINE, INSERT and (optionally) SET RECORD commands to simulate its behavior correctly.
This transformation is fully explained in the following subsections.
SET RECORD¶
As stated above, this command is not required for the transformation of the BEGIN LOADING. If not found, the default delimiter will be set to ‘,’ (comma). Else, the defined delimiter will be used. This value is stored in the ssc_set_record variable.
As of now only SET RECORD VARTEXT, SET RECORD FORMATTED and SET RECORD UNFORMATTED are supported. For the BINARY and TEXT keyword specification an error EWI is placed instead.
Teradata (FastLoad)
Snowflake (Python)
DEFINE¶
The transformation for the DEFINE command sets the ssc_define_columns and ssc_define_file variables with the value of the columns definition and the file path to be used in the BEGIN LOADING transformation respectively.
Teradata (FastLoad)
Snowflake (Python)
BEGIN LOADING¶
The BEGIN LOADING command is commented out since the relevant information for the transformation is found in the associated INSERT statement instead.
ERRORFILES, NODROP, CHECKPOINT, INDICATORS and DATAENCRYPTION specifications are not necessary for the transformation and thus commented out.
Teradata (FastLoad)
Snowflake (Python)
INSERT¶
The transformation for the associated INSERT statement sets the value for the ssc_begin_loading_columns and ssc_begin_loading_values variables, used to determine the order in which to insert the values to be loaded.
Finally, these variables and the ones described in the above sections are used to call the BeginLoading.import_file_to_table function part of the SnowConvert.Helpers module. This function simulates the behavior of the whole FastLoad BEGIN LOADING process. To learn more about this function check here.
Teradata (FastLoad)
Snowflake (Python)
Internally, the import_file_to_table function creates a temporary stage and puts the local file in the stage to load into the specified table. However, the file might be already stored in one the supported cloud provider by Snowflake:
| Stage | Input Data Place Holder |
|---|---|
| Stage | Input Data Place Holder |
| Internal stage | @my_int_stage |
| External stage | @my_int_stage/path/file.csv |
| Amazon S3 bucket | s3://mybucket/data/files |
| Google Cloud Storage | gcs://mybucket/data/files |
| Microsoft Azure | |
If this is the case, please manually add the additional parameter input_data_place_holder="<cloud_provider_path>" in the import_file_to_table function. For example:
END LOADING¶
The END LOADING command is commented out since is not necessary for the transformation of the BEGIN LOADING.
Teradata (FastLoad)
Snowflake (Python)
Known Issues¶
1. BINARY and TEXT keyword specification not supported
The BINARY and TEXT keyword specification for the SET RECORD command are not yet supported.
2. Only base specification for VARTEXT is supported
Extra specifications for the SET RECORD VARTEXT such as TRIM or QUOTE are not yet supported.
Related EWIs¶
- SSC-FDM-0007: Element with missing dependencies.
- SSC-FDM-0027: Removed next statement, not applicable in Snowflake.
- SSC-EWI-0021: Not supported.
- SSC-FDM-TD0022: Shell variables found, running this code in a shell script is required.