Translation specification for the USING REQUEST MODIFIER query.
Some parts in the output code are omitted for clarity reasons.
As per Teradata's documentation, the USING REQUEST MODIFIER defines one or more variable parameter names to be used in the subsequent SELECT, INSERT, UPDATE, or DELETE statements to import or export data.
As stated in Teradata's documentation, the USING REQUEST MODIFIER needs to be preceded by an .IMPORT statement for it to load the data into the defined parameters.
Thus, the transformation for this statement follows these steps:
Call the import_file() function from the SnowConvert Helpers. This loads the data into a temporary file.
Call the using() function from the SnowConvert Helpers to create a dictionary with the loaded data.
For each query, run the exec() function from the SnowConvert Helpers and pass the previously defined dictionary. This will use Snowflake Python Connector data binding capabilities.
With this input data:
A,B,C
Teradata (MultiLoad)
IN -> Teradata_01.bteq
.IMPORT DATA FILE = inputData.dat;USING var_1 (CHARACTER), var_2 (CHARACTER), var_3 (CHARACTER)INSERT INTO testtabu (c1) VALUES (:var_1);INSERT INTO testtabu (c1) VALUES (:var_2) ;INSERT INTO testtabu (c1) VALUES (:var_3) ;UPDATE testtabu SET c2 = 'X' WHERE c1 = :var_1 ;UPDATE testtabu SET c2 = 'Y' WHERE c1 = :var_2 ;UPDATE testtabu SET c2 = 'Z' WHERE c1 = :var_3;
ROW
C1
C2
1
A
X
2
B
Y
3
C
Z
Snowflake (Python)
OUT -> Teradata_01.py
#*** Generated code is based on the SnowConvert Python Helpers version 2.0.6 ***import osimport sysimport snowconvert.helpersfrom snowconvert.helpers import Exportfrom snowconvert.helpers importexecfrom snowconvert.helpers import BeginLoadingcon =Nonedefmain(): snowconvert.helpers.configure_log() con = snowconvert.helpers.log_on() snowconvert.helpers.import_file(fr"inputData.dat") using = snowconvert.helpers.using("var_1", "CHARACTER", "var_2", "CHARACTER", "var_3", "CHARACTER", rows_to_read =1)exec(""" INSERT INTO testtabu (c1) VALUES (:var_1) """, using = using)exec(""" INSERT INTO testtabu (c1) VALUES (:var_2) """, using = using)exec(""" INSERT INTO testtabu (c1) VALUES (:var_3) """, using = using)exec(""" UPDATE testtabu SET c2 = 'X' WHERE c1 = :var_1 """, using = using)exec(""" UPDATE testtabu SET c2 = 'Y' WHERE c1 = :var_2 """, using = using)exec(""" UPDATE testtabu SET c2 = 'Z' WHERE c1 = :var_3 """, using = using) snowconvert.helpers.quit_application()if__name__=="__main__":main()
ROW
C1
C2
1
A
X
2
B
Y
3
C
Z
Known Issues
1. .REPEAT command is not yet supported
The .REPEAT command is not yet supported. This means that the USING REQUEST MODIFIER will only use the data loaded from the first row of the input file. Thus, the queries will only run once.
This issue should be fixed when the .REPEAT command receives proper transformation support.