SSC-FDM-TD0022
Shell variables found, running this code in a shell script is required.
Description
In Teradata scripts, shell variables are used to store temporary values that can be accessed and manipulated throughout the script. Shell variables are defined using the dollar sign ($) followed by a name (which can be enclosed by curly braces), and their values can be set using the assignment operator (=).
#!/bin/bash
# define a shell variable
tablename="mytable"
# use the variable in a Teradata SQL query
bteq <<EOF
.LOGON myhost/myuser,mypassword
SELECT * FROM ${tablename};
.LOGOFF
EOF
You can think of shell variables having the same or similar function as string interpolation. Thus, it is important to keep this functionality when transformed. When converting Scripts to Python, shell variables keep their functionality by running the converted code in a shell script (.sh file). For this reason, these shell variables must keep the same format as the input code.
Example Code
Input Code:
SELECT $column FROM ${tablename}
Output Code
#*** Generated code is based on the SnowConvert Python Helpers version 2.0.6 ***
import os
import sys
import snowconvert.helpers
from snowconvert.helpers import Export
from snowconvert.helpers import exec
from snowconvert.helpers import BeginLoading
con = None
#** SSC-FDM-TD0022 - SHELL VARIABLES FOUND, RUNNING THIS CODE IN A SHELL SCRIPT IS REQUIRED **
def main():
snowconvert.helpers.configure_log()
con = snowconvert.helpers.log_on()
exec("""
SELECT
$column
FROM
${tablename}
""")
snowconvert.helpers.quit_application()
if __name__ == "__main__":
main()
Recommendations
Running the converted code in a shell script is required.
If you need more support, you can email us at snowconvert-support@snowflake.com
Last updated