From 51879f2993d96d3d52e49ebe1747dc84ce347d31 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Rojas Date: Tue, 27 Feb 2024 15:02:01 -0600 Subject: [PATCH 1/3] Update output text with more detailed information about the execution. --- Teradata/README.md | 2 +- Teradata/bin/create_ddls.sh | 83 +++++++--- .../scripts_template/create_databases.btq | 15 ++ Teradata/scripts_template/create_ddls.btq | 151 ------------------ .../scripts_template/create_functions.btq | 19 +++ .../scripts_template/create_join_indexes.btq | 18 +++ Teradata/scripts_template/create_macros.btq | 18 +++ .../scripts_template/create_procedures.btq | 18 +++ Teradata/scripts_template/create_schemas.btq | 14 ++ Teradata/scripts_template/create_tables.btq | 27 ++++ Teradata/scripts_template/create_triggers.btq | 27 ++++ Teradata/scripts_template/create_views.btq | 26 +++ 12 files changed, 247 insertions(+), 171 deletions(-) create mode 100644 Teradata/scripts_template/create_databases.btq delete mode 100644 Teradata/scripts_template/create_ddls.btq create mode 100644 Teradata/scripts_template/create_functions.btq create mode 100644 Teradata/scripts_template/create_join_indexes.btq create mode 100644 Teradata/scripts_template/create_macros.btq create mode 100644 Teradata/scripts_template/create_procedures.btq create mode 100644 Teradata/scripts_template/create_schemas.btq create mode 100644 Teradata/scripts_template/create_tables.btq create mode 100644 Teradata/scripts_template/create_triggers.btq create mode 100644 Teradata/scripts_template/create_views.btq diff --git a/Teradata/README.md b/Teradata/README.md index 1c1d2a2..69e70ac 100644 --- a/Teradata/README.md +++ b/Teradata/README.md @@ -4,7 +4,7 @@ This repository provides some simple scripts to help exporting your Teradata cod ## Version -Release 2023-02-23 +Release 2023-02-27 ## Usage diff --git a/Teradata/bin/create_ddls.sh b/Teradata/bin/create_ddls.sh index 21c9b92..1069108 100644 --- a/Teradata/bin/create_ddls.sh +++ b/Teradata/bin/create_ddls.sh @@ -1,10 +1,12 @@ # -#Version 20201105: Script created -#Version 20211210: Fix error messages -#Version 20230811: Add command to copy the scripts from scripts_template. -#Version 20240201: Add spliting mechanism for output code. -#Version 20240223: Remove spliting mechanism for output code. +#Version 2020-11-05: Script created. +#Version 2021-12-10: Fix error messages. +#Version 2023-08-11: Add command to copy the scripts from scripts_template. +#Version 2024-02-01: Add spliting mechanism for output code. +#Version 2024-02-23: Remove spliting mechanism for output code. +#Version 2024-02-27: Update output text with more detailed information about the execution. +##### PARAMETERS ##### Modify the connection information connection_string="dbc,dbc" @@ -23,7 +25,10 @@ exclude_databases="(UPPER(T1.DATABASENAME) NOT IN ('SYS_CALENDAR','ALL','CONSOLE ##### Use uppercase names. include_objects="(UPPER(T1.TABLENAME) LIKE ANY ('%'))" -##### Creates directory for output and log files. +##### CONSTANTS +steps="5" + +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 1/${steps} - Creating Directories: Started" mkdir -p ../log mkdir -p ../temp mkdir -p ../output @@ -31,18 +36,55 @@ mkdir -p ../output/object_extracts mkdir -p ../output/object_extracts/DDL cp -r ../scripts_template ../scripts touch -- "../output/object_extracts/DDL/.sc_extracted" +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 1/${steps} - Creating Directories: Completed" + + +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 2/${steps} - Extracting DDLs: Started" +declare -a scripts_file=( +[0]="create_databases" +[1]="create_functions" +[2]="create_join_indexes" +[3]="create_macros" +[4]="create_procedures" +[5]="create_schemas" +[6]="create_tables" +[7]="create_triggers" +[8]="create_views" +) + +declare -a scripts_name=( +[0]="databases" +[1]="functions" +[2]="join indexes" +[3]="macros" +[4]="procedures" +[5]="schemas" +[6]="tables" +[7]="triggers" +[8]="views" +) + -##### Updates BTEQ files with the correct list of databases and connection info. -sed -i "s|include_databases|$include_databases|g" ../scripts/create_ddls.btq -sed -i "s|exclude_databases|$exclude_databases|g" ../scripts/create_ddls.btq -sed -i "s|include_objects|$include_objects|g" ../scripts/create_ddls.btq -sed -i "s|connection_string|$connection_string|g" ../scripts/create_ddls.btq +for i in "${!scripts_file[@]}"; do + echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Start extracting ${scripts_name[$i]}" -##### Executes DDL extracts and DDL Reports -echo 'Creating DDLS...' -bteq <../scripts/create_ddls.btq >../log/create_ddls.log 2>&1 + if [[ ! -f ../scripts/"${scripts_file[$i]}".btq ]] + then + echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] ERROR: file ${scripts_file[$i]} not found" + fi + sed -i "s|include_databases|$include_databases|g" ../scripts/"${scripts_file[$i]}".btq + sed -i "s|exclude_databases|$exclude_databases|g" ../scripts/"${scripts_file[$i]}".btq + sed -i "s|include_objects|$include_objects|g" ../scripts/"${scripts_file[$i]}".btq + sed -i "s|connection_string|$connection_string|g" ../scripts/"${scripts_file[$i]}".btq + bteq <../scripts/"${scripts_file[$i]}".btq >../log/${scripts_file[$i]}.log 2>&1 + + echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Extracted ${scripts_name[$i]}" -echo 'Removing unnecessary comments...' +done +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 2/${steps} - Extracting DDLs: Completed" + + +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 3/${steps} - Removing unnecessary comments: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Views.sql @@ -50,16 +92,19 @@ echo 'Removing unnecessary comments...' [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Procedures.sql [[ ! -f ../output/object_extracts/DDL/DDL_SF_Schemas.sql ]] || sed -i "s| |\n|g" ../output/object_extracts/DDL/DDL_SF_Schemas.sql +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 3/${steps} - Removing unnecessary comments: Completed" -echo 'Replacing unicode values...' +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 4/${steps} - Replacing unicode values: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Views.sql [[ ! -f ../output/object_extracts/DDL/DDL_Functions.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Functions.sql [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Procedures.sql +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 4/${steps} - Replacing unicode values: Completed" -echo '...DDL Creation Complete' - +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 5/${steps} - Removing temporal files: Started" rm -r ../temp -rm -r ../scripts \ No newline at end of file +rm -r ../scripts + +echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 5/${steps} - Removing temporal files: Completed" \ No newline at end of file diff --git a/Teradata/scripts_template/create_databases.btq b/Teradata/scripts_template/create_databases.btq new file mode 100644 index 0000000..26d9608 --- /dev/null +++ b/Teradata/scripts_template/create_databases.btq @@ -0,0 +1,15 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.OS rm ../output/object_extracts/DDL/DDL_Databases.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Databases.sql +.SET WIDTH 65531 +SELECT 'CREATE DATABASE ' || TRIM(T1.DATABASENAME) || ' FROM DBC AS PERM = 100000000;' "--" FROM DBC.DATABASESV T1 + WHERE include_databases AND exclude_databases GROUP BY 1 ORDER BY 1; +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_ddls.btq b/Teradata/scripts_template/create_ddls.btq deleted file mode 100644 index ec11107..0000000 --- a/Teradata/scripts_template/create_ddls.btq +++ /dev/null @@ -1,151 +0,0 @@ -**** Modified by: Najeeb Lateef -**** Modified Date: 10 MAR 2023 -**** Description: -**** USE SHOW DDL ONLY FOR -**** DDLS > 12K , Altered, comments with -- -**** Single export file TABLE and VIEWS (each) -**** Triggers added to extraction process -******-- OR T1.REQUESTTEXT like '%--%' OR T1.REQUESTTEXT like '%/*%' -- Un comment this ine Comments are not needed - -**** Modified by: Jorge Vasquez -**** Modified date: 2024-02-01 -**** Description: -**** USE SHOW DDL for all cases to avoid the REQUESTTEXT column bugs. - -.LOGON connection_string; - -.EXPORT RESET - -.SET WIDTH 65531 -.set titledashes off - -**** CREATE TABLES FILE **** - -.EXPORT RESET -.EXPORT FILE = ../temp/SHOW_Tables.sql - -.SET WIDTH 65531 -.set titledashes off -LOCKING ROW FOR ACCESS --- GENERATE SHOW TABLE STATEMENT FOR LONG DDLS -SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW TABLE ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" - FROM DBC.TABLESV T1 - WHERE T1.TABLEKIND IN ( 'T' ,'O','Q') -- PI AND NOPI - AND include_databases AND exclude_databases AND include_objects; - -.OS rm ../output/object_extracts/DDL/DDL_Tables.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Tables.sql - -.SET WIDTH 65531 -.set titledashes off -.RUN FILE = ../temp/SHOW_Tables.sql -.EXPORT RESET - - -**** CREATE JOIN INDEXES FILE **** -.EXPORT FILE = ../temp/SHOW_Join_Indexes.sql -.SET WIDTH 65531 -SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW JOIN INDEX ' || TRIM(T1.DATABASENAME) || '.' ||TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND IN ('I') AND include_databases AND exclude_databases AND include_objects GROUP BY 1; -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Join_Indexes.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Join_Indexes.sql -.SET WIDTH 65531 -.RUN FILE = ../temp/SHOW_Join_Indexes.sql -.EXPORT RESET - - -**** CREATE VIEWS FILE **** - --- SHOW VIEWS STATEMENTS -.EXPORT FILE = ../temp/SHOW_Views.sql -.SET WIDTH 65531 -.set titledashes off -LOCKING ROW FOR ACCESS --- GENERATE SHOW VIEW STATEMENTS -SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW VIEW ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" -FROM DBC.TABLESV T1 -WHERE T1.TABLEKIND = 'V' - AND include_databases AND exclude_databases AND include_objects; -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Views.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Views.sql -.SET WIDTH 65531 -.set titledashes off -.RUN FILE = ../temp/SHOW_Views.sql -.EXPORT RESET - -**** CREATE FUNCTIONS FILE **** -.EXPORT FILE = ../temp/SHOW_Functions.sql -.SET WIDTH 65531 -SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.SpecificNAME) || ' */'' as "--"; ' || 'SHOW FUNCTION ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.FUNCTIONNAME) || ';' "---" -FROM DBC.FUNCTIONSV T1 WHERE include_databases AND exclude_databases GROUP BY 1; -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Functions.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Functions.sql -.SET WIDTH 65531 -.RUN FILE = ../temp/SHOW_Functions.sql -.EXPORT RESET - -**** CREATE MACROS FILE **** -.EXPORT FILE = ../temp/SHOW_Macros.sql -.SET WIDTH 65531 -SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW MACRO ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND = 'M' AND include_databases AND exclude_databases AND include_objects GROUP BY 1; -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Macros.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Macros.sql -.SET WIDTH 65531 -.RUN FILE = ../temp/SHOW_Macros.sql -.EXPORT RESET - - -**** CREATE PROCEDURES FILE **** -.EXPORT FILE = ../temp/SHOW_Procedures.sql -.SET WIDTH 65531 -SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW PROCEDURE ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND = 'P' AND include_databases AND exclude_databases AND include_objects GROUP BY 1; -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Procedures.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Procedures.sql -.SET WIDTH 65531 -.RUN FILE = ../temp/SHOW_Procedures.sql -.EXPORT RESET - - -**** CREATE DATABASES FILE **** -.OS rm ../output/object_extracts/DDL/DDL_Databases.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Databases.sql -.SET WIDTH 65531 -SELECT 'CREATE DATABASE ' || TRIM(T1.DATABASENAME) || ' FROM DBC AS PERM = 100000000;' "--" FROM DBC.DATABASESV T1 - WHERE include_databases AND exclude_databases GROUP BY 1 ORDER BY 1; -.EXPORT RESET - - -**** CREATE SNOWFLAKE SCHEMA FILE **** -.OS rm ../output/object_extracts/DDL/DDL_SF_Schemas.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_SF_Schemas.sql -.SET WIDTH 65531 -SELECT '/* ' || TRIM(T1.DATABASENAME) || ' */ ' || 'CREATE SCHEMA ' || TRIM(T1.DATABASENAME) || ';' "--" FROM DBC.DATABASESV T1 WHERE include_databases AND exclude_databases GROUP BY 1 ORDER BY 1; -.EXPORT RESET - - -**** CREATE TRIGGER FILE **** - -.EXPORT FILE = ../temp/SHOW_Trigger.sql -.SET WIDTH 65531 -.set titledashes off -LOCKING ROW FOR ACCESS --- GENERATE SHOW VIEW STATEMENTS -SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW TRIGGER ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" -FROM DBC.TABLESV T1 -WHERE T1.TABLEKIND = 'G' -- TRIGGERS - AND include_databases AND exclude_databases AND include_objects; - -.EXPORT RESET -.OS rm ../output/object_extracts/DDL/DDL_Trigger.sql -.EXPORT FILE = ../output/object_extracts/DDL/DDL_Trigger.sql -.SET WIDTH 65531 -.set titledashes off -.RUN FILE = ../temp/SHOW_Trigger.sql -.EXPORT RESET - - -.quit 0; diff --git a/Teradata/scripts_template/create_functions.btq b/Teradata/scripts_template/create_functions.btq new file mode 100644 index 0000000..7d0d464 --- /dev/null +++ b/Teradata/scripts_template/create_functions.btq @@ -0,0 +1,19 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Functions.sql +.SET WIDTH 65531 +SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.SpecificNAME) || ' */'' as "--"; ' || 'SHOW FUNCTION ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.FUNCTIONNAME) || ';' "---" +FROM DBC.FUNCTIONSV T1 WHERE include_databases AND exclude_databases GROUP BY 1; +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Functions.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Functions.sql +.SET WIDTH 65531 +.RUN FILE = ../temp/SHOW_Functions.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_join_indexes.btq b/Teradata/scripts_template/create_join_indexes.btq new file mode 100644 index 0000000..c5f4507 --- /dev/null +++ b/Teradata/scripts_template/create_join_indexes.btq @@ -0,0 +1,18 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Join_Indexes.sql +.SET WIDTH 65531 +SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW JOIN INDEX ' || TRIM(T1.DATABASENAME) || '.' ||TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND IN ('I') AND include_databases AND exclude_databases AND include_objects GROUP BY 1; +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Join_Indexes.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Join_Indexes.sql +.SET WIDTH 65531 +.RUN FILE = ../temp/SHOW_Join_Indexes.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_macros.btq b/Teradata/scripts_template/create_macros.btq new file mode 100644 index 0000000..0866e09 --- /dev/null +++ b/Teradata/scripts_template/create_macros.btq @@ -0,0 +1,18 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Macros.sql +.SET WIDTH 65531 +SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW MACRO ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND = 'M' AND include_databases AND exclude_databases AND include_objects GROUP BY 1; +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Macros.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Macros.sql +.SET WIDTH 65531 +.RUN FILE = ../temp/SHOW_Macros.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_procedures.btq b/Teradata/scripts_template/create_procedures.btq new file mode 100644 index 0000000..6dd7ab8 --- /dev/null +++ b/Teradata/scripts_template/create_procedures.btq @@ -0,0 +1,18 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Procedures.sql +.SET WIDTH 65531 +SELECT 'SELECT ''/* '' || ''' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ' */'' as "--"; ' || 'SHOW PROCEDURE ' || TRIM(T1.DATABASENAME) || '.' || TRIM(T1.TABLENAME) || ';' "--" FROM DBC.TABLESV T1 WHERE T1.TABLEKIND = 'P' AND include_databases AND exclude_databases AND include_objects GROUP BY 1; +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Procedures.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Procedures.sql +.SET WIDTH 65531 +.RUN FILE = ../temp/SHOW_Procedures.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_schemas.btq b/Teradata/scripts_template/create_schemas.btq new file mode 100644 index 0000000..0cef4e2 --- /dev/null +++ b/Teradata/scripts_template/create_schemas.btq @@ -0,0 +1,14 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.OS rm ../output/object_extracts/DDL/DDL_SF_Schemas.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_SF_Schemas.sql +.SET WIDTH 65531 +SELECT '/* ' || TRIM(T1.DATABASENAME) || ' */ ' || 'CREATE SCHEMA ' || TRIM(T1.DATABASENAME) || ';' "--" FROM DBC.DATABASESV T1 WHERE include_databases AND exclude_databases GROUP BY 1 ORDER BY 1; +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_tables.btq b/Teradata/scripts_template/create_tables.btq new file mode 100644 index 0000000..d79c659 --- /dev/null +++ b/Teradata/scripts_template/create_tables.btq @@ -0,0 +1,27 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Tables.sql +.SET WIDTH 65531 +.set titledashes off + +LOCKING ROW FOR ACCESS +SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW TABLE ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" + FROM DBC.TABLESV T1 + WHERE T1.TABLEKIND IN ( 'T' ,'O','Q') -- PI AND NOPI + AND include_databases AND exclude_databases AND include_objects; + +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Tables.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Tables.sql + +.SET WIDTH 65531 +.set titledashes off +.RUN FILE = ../temp/SHOW_Tables.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_triggers.btq b/Teradata/scripts_template/create_triggers.btq new file mode 100644 index 0000000..3365f28 --- /dev/null +++ b/Teradata/scripts_template/create_triggers.btq @@ -0,0 +1,27 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Trigger.sql +.SET WIDTH 65531 +.set titledashes off + +LOCKING ROW FOR ACCESS +SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW TRIGGER ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" +FROM DBC.TABLESV T1 +WHERE T1.TABLEKIND = 'G' -- TRIGGERS + AND include_databases AND exclude_databases AND include_objects; + +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Trigger.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Trigger.sql + +.SET WIDTH 65531 +.set titledashes off +.RUN FILE = ../temp/SHOW_Trigger.sql +.EXPORT RESET + +.quit 0; diff --git a/Teradata/scripts_template/create_views.btq b/Teradata/scripts_template/create_views.btq new file mode 100644 index 0000000..acf8fa1 --- /dev/null +++ b/Teradata/scripts_template/create_views.btq @@ -0,0 +1,26 @@ +.LOGON connection_string; + +.EXPORT RESET + +.SET WIDTH 65531 +.set titledashes off + +.EXPORT FILE = ../temp/SHOW_Views.sql +.SET WIDTH 65531 +.set titledashes off + +LOCKING ROW FOR ACCESS +SELECT 'SELECT ''/* '' || ''' || TRIM(DATABASENAME) || '.' || TRIM(TABLENAME) || ' */'' as "--"; ' || 'SHOW VIEW ' || TRIM(DATABASENAME) || '.' ||TRIM(TABLENAME) || ';' "--" +FROM DBC.TABLESV T1 +WHERE T1.TABLEKIND = 'V' -- VIEWS + AND include_databases AND exclude_databases AND include_objects; + +.EXPORT RESET +.OS rm ../output/object_extracts/DDL/DDL_Views.sql +.EXPORT FILE = ../output/object_extracts/DDL/DDL_Views.sql +.SET WIDTH 65531 +.set titledashes off +.RUN FILE = ../temp/SHOW_Views.sql +.EXPORT RESET + +.quit 0; \ No newline at end of file From 0c44ae8f1744eed0cba288b39381a166a8e7f421 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Rojas Date: Tue, 27 Feb 2024 15:08:47 -0600 Subject: [PATCH 2/3] Add function to get current date --- Teradata/bin/create_ddls.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Teradata/bin/create_ddls.sh b/Teradata/bin/create_ddls.sh index 1069108..0a61544 100644 --- a/Teradata/bin/create_ddls.sh +++ b/Teradata/bin/create_ddls.sh @@ -28,7 +28,12 @@ include_objects="(UPPER(T1.TABLENAME) LIKE ANY ('%'))" ##### CONSTANTS steps="5" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 1/${steps} - Creating Directories: Started" +function get_current_date +{ + date '+%Y/%m/%d %l:%M:%S%p' +} + +echo "[$(get_current_date)] Info: Step 1/${steps} - Creating Directories: Started" mkdir -p ../log mkdir -p ../temp mkdir -p ../output @@ -36,10 +41,10 @@ mkdir -p ../output/object_extracts mkdir -p ../output/object_extracts/DDL cp -r ../scripts_template ../scripts touch -- "../output/object_extracts/DDL/.sc_extracted" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 1/${steps} - Creating Directories: Completed" +echo "[$(get_current_date)] Info: Step 1/${steps} - Creating Directories: Completed" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 2/${steps} - Extracting DDLs: Started" +echo "[$(get_current_date)] Info: Step 2/${steps} - Extracting DDLs: Started" declare -a scripts_file=( [0]="create_databases" [1]="create_functions" @@ -66,11 +71,11 @@ declare -a scripts_name=( for i in "${!scripts_file[@]}"; do - echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Start extracting ${scripts_name[$i]}" + echo "[$(get_current_date)] Info: Start extracting ${scripts_name[$i]}" if [[ ! -f ../scripts/"${scripts_file[$i]}".btq ]] then - echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] ERROR: file ${scripts_file[$i]} not found" + echo "[$(get_current_date)] ERROR: file ${scripts_file[$i]} not found" fi sed -i "s|include_databases|$include_databases|g" ../scripts/"${scripts_file[$i]}".btq sed -i "s|exclude_databases|$exclude_databases|g" ../scripts/"${scripts_file[$i]}".btq @@ -78,13 +83,13 @@ for i in "${!scripts_file[@]}"; do sed -i "s|connection_string|$connection_string|g" ../scripts/"${scripts_file[$i]}".btq bteq <../scripts/"${scripts_file[$i]}".btq >../log/${scripts_file[$i]}.log 2>&1 - echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Extracted ${scripts_name[$i]}" + echo "[$(get_current_date)] Info: Extracted ${scripts_name[$i]}" done -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 2/${steps} - Extracting DDLs: Completed" +echo "[$(get_current_date)] Info: Step 2/${steps} - Extracting DDLs: Completed" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 3/${steps} - Removing unnecessary comments: Started" +echo "[$(get_current_date)] Info: Step 3/${steps} - Removing unnecessary comments: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Views.sql @@ -92,19 +97,19 @@ echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 3/${steps} - Removing unnecess [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Procedures.sql [[ ! -f ../output/object_extracts/DDL/DDL_SF_Schemas.sql ]] || sed -i "s| |\n|g" ../output/object_extracts/DDL/DDL_SF_Schemas.sql -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 3/${steps} - Removing unnecessary comments: Completed" +echo "[$(get_current_date)] Info: Step 3/${steps} - Removing unnecessary comments: Completed" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 4/${steps} - Replacing unicode values: Started" +echo "[$(get_current_date)] Info: Step 4/${steps} - Replacing unicode values: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Views.sql [[ ! -f ../output/object_extracts/DDL/DDL_Functions.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Functions.sql [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Procedures.sql -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 4/${steps} - Replacing unicode values: Completed" +echo "[$(get_current_date)] Info: Step 4/${steps} - Replacing unicode values: Completed" -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 5/${steps} - Removing temporal files: Started" +echo "[$(get_current_date)] Info: Step 5/${steps} - Removing temporal files: Started" rm -r ../temp rm -r ../scripts -echo "[$(date '+%Y/%m/%d %l:%M:%S%p')] Info: Step 5/${steps} - Removing temporal files: Completed" \ No newline at end of file +echo "[$(get_current_date)] Info: Step 5/${steps} - Removing temporal files: Completed" \ No newline at end of file From 00fef04d58802cf81c6d42fd8a0f38d5b624fb33 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Rojas Date: Tue, 27 Feb 2024 15:09:58 -0600 Subject: [PATCH 3/3] Update function name get_current_date to get_current_timestamp --- Teradata/bin/create_ddls.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Teradata/bin/create_ddls.sh b/Teradata/bin/create_ddls.sh index 0a61544..d6502a2 100644 --- a/Teradata/bin/create_ddls.sh +++ b/Teradata/bin/create_ddls.sh @@ -28,12 +28,12 @@ include_objects="(UPPER(T1.TABLENAME) LIKE ANY ('%'))" ##### CONSTANTS steps="5" -function get_current_date +function get_current_timestamp { date '+%Y/%m/%d %l:%M:%S%p' } -echo "[$(get_current_date)] Info: Step 1/${steps} - Creating Directories: Started" +echo "[$(get_current_timestamp)] Info: Step 1/${steps} - Creating Directories: Started" mkdir -p ../log mkdir -p ../temp mkdir -p ../output @@ -41,10 +41,10 @@ mkdir -p ../output/object_extracts mkdir -p ../output/object_extracts/DDL cp -r ../scripts_template ../scripts touch -- "../output/object_extracts/DDL/.sc_extracted" -echo "[$(get_current_date)] Info: Step 1/${steps} - Creating Directories: Completed" +echo "[$(get_current_timestamp)] Info: Step 1/${steps} - Creating Directories: Completed" -echo "[$(get_current_date)] Info: Step 2/${steps} - Extracting DDLs: Started" +echo "[$(get_current_timestamp)] Info: Step 2/${steps} - Extracting DDLs: Started" declare -a scripts_file=( [0]="create_databases" [1]="create_functions" @@ -71,11 +71,11 @@ declare -a scripts_name=( for i in "${!scripts_file[@]}"; do - echo "[$(get_current_date)] Info: Start extracting ${scripts_name[$i]}" + echo "[$(get_current_timestamp)] Info: Start extracting ${scripts_name[$i]}" if [[ ! -f ../scripts/"${scripts_file[$i]}".btq ]] then - echo "[$(get_current_date)] ERROR: file ${scripts_file[$i]} not found" + echo "[$(get_current_timestamp)] ERROR: file ${scripts_file[$i]} not found" fi sed -i "s|include_databases|$include_databases|g" ../scripts/"${scripts_file[$i]}".btq sed -i "s|exclude_databases|$exclude_databases|g" ../scripts/"${scripts_file[$i]}".btq @@ -83,13 +83,13 @@ for i in "${!scripts_file[@]}"; do sed -i "s|connection_string|$connection_string|g" ../scripts/"${scripts_file[$i]}".btq bteq <../scripts/"${scripts_file[$i]}".btq >../log/${scripts_file[$i]}.log 2>&1 - echo "[$(get_current_date)] Info: Extracted ${scripts_name[$i]}" + echo "[$(get_current_timestamp)] Info: Extracted ${scripts_name[$i]}" done -echo "[$(get_current_date)] Info: Step 2/${steps} - Extracting DDLs: Completed" +echo "[$(get_current_timestamp)] Info: Step 2/${steps} - Extracting DDLs: Completed" -echo "[$(get_current_date)] Info: Step 3/${steps} - Removing unnecessary comments: Started" +echo "[$(get_current_timestamp)] Info: Step 3/${steps} - Removing unnecessary comments: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Views.sql @@ -97,19 +97,19 @@ echo "[$(get_current_date)] Info: Step 3/${steps} - Removing unnecessary comment [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i "s|--------------.*--------------||g" ../output/object_extracts/DDL/DDL_Procedures.sql [[ ! -f ../output/object_extracts/DDL/DDL_SF_Schemas.sql ]] || sed -i "s| |\n|g" ../output/object_extracts/DDL/DDL_SF_Schemas.sql -echo "[$(get_current_date)] Info: Step 3/${steps} - Removing unnecessary comments: Completed" +echo "[$(get_current_timestamp)] Info: Step 3/${steps} - Removing unnecessary comments: Completed" -echo "[$(get_current_date)] Info: Step 4/${steps} - Replacing unicode values: Started" +echo "[$(get_current_timestamp)] Info: Step 4/${steps} - Replacing unicode values: Started" [[ ! -f ../output/object_extracts/DDL/DDL_Tables.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Tables.sql [[ ! -f ../output/object_extracts/DDL/DDL_Join_Indexes.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Join_Indexes.sql [[ ! -f ../output/object_extracts/DDL/DDL_Views.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Views.sql [[ ! -f ../output/object_extracts/DDL/DDL_Functions.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Functions.sql [[ ! -f ../output/object_extracts/DDL/DDL_Macros.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Macros.sql [[ ! -f ../output/object_extracts/DDL/DDL_Procedures.sql ]] || sed -i -e "s|\U2013|-|g" -e "s|\U00D8|0|g" -e "s|\U00A0| |g" -e "s|\U1680| |g" -e "s|\U180E| |g" -e "s|\U2000| |g" -e "s|\U2001| |g" -e "s|\U2002| |g" -e "s|\U2003| |g" -e "s|\U2004| |g" -e "s|\U2005| |g" -e "s|\U2006| |g" -e "s|\U2007| |g" -e "s|\U2008| |g" -e "s|\U2009| |g" -e "s|\U200A| |g" -e "s|\U200B| |g" -e "s|\U202F| |g" -e "s|\U205F| |g" -e "s|\U3000| |g" -e "s|\UFEFF| |g" ../output/object_extracts/DDL/DDL_Procedures.sql -echo "[$(get_current_date)] Info: Step 4/${steps} - Replacing unicode values: Completed" +echo "[$(get_current_timestamp)] Info: Step 4/${steps} - Replacing unicode values: Completed" -echo "[$(get_current_date)] Info: Step 5/${steps} - Removing temporal files: Started" +echo "[$(get_current_timestamp)] Info: Step 5/${steps} - Removing temporal files: Started" rm -r ../temp rm -r ../scripts -echo "[$(get_current_date)] Info: Step 5/${steps} - Removing temporal files: Completed" \ No newline at end of file +echo "[$(get_current_timestamp)] Info: Step 5/${steps} - Removing temporal files: Completed" \ No newline at end of file