Help Center/ GaussDB(DWS)/ Tool Guide/ DSC/ Using DSC/ Configuring DSC/ Teradata Perl Configuration
Updated on 2024-12-09 GMT+08:00

Teradata Perl Configuration

Teradata Perl parameters are used to customize rules for Teradata Perl script migration.

Open the perl-migration.properties file in the config folder and set parameters in Table 1 as required.

  • Parameter values are case-insensitive.
  • You can modify the values of the following two parameters db-bteq-tag-name and db-tdsql-tag-name parameters in the following table:
Table 1 Parameters in the perl-migration.properties file

Parameter

Description

Value Range

Default

Example

  • db-bteq-tag-name

Scripts to be processed in Perl files.

BTEQ: Only the scripts under the BTEQ tag are processed.

  • bteq

bteq

db-bteq-tag-name=bteq

  • db-tdsql-tag-name

Only the scripts under the db-tdsql-tag-name tag are processed.

SQL_LANG: Only the scripts under the SQL_LANG tag are processed.

sql_lang

sql_lang

db-tdsql-tag-name=sql_lang

  • add-timing-on

Whether to enable the insertion of scripts to calculate execution time.

If it is enabled, the script will be added to each input file.

  • true
  • false

false

add-timing-on=true

  • remove-intermediate-files

Whether to delete the intermediate SQL file generated by the DSC after the migration is complete.

The intermediate files contain the BTEQ and SQL_LANG syntax in SQL files. These files are used as input for DSC.

true: deletes the intermediate files.

false: does not delete the intermediate files.

  • true
  • false

true

remove-intermediate-files=true

  • migrate-variables

Whether to enable the migration of Perl variables containing SQL statements.

Perl files can contain Perl variables with SQL statements. These variables are executed by using the PREPARE and EXECUTE statement in Perl. DSC can extract SQL statements from Perl variables and migrate them.

true: enables the migration of Perl variables containing SQL statements.

false: disables the migration of Perl variables containing SQL statements.

Example 1:

If migrate-variables is set to true and the target table is:

1
$V_SQL = "CT X1(C1 INT,C2 CHAR(30))";

Output

1
CREATE TABLE X1(C1 INT,C2 CHAR(30));

Example 2:

Input

1
2
3
4
$onesql ="SELECT trim(tablename) from dbc.tables       
           WHERE databasename = '${AUTO_DQDB}' and tablename like 'V_%' 
           order by 1;";
  $sth_rundq = $dbh->execute_query($onesql);

Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  $onesql ="SELECT
          TRIM( tablename )
     FROM
          dbc.tables
     WHERE
          databasename = '${AUTO_DQDB}'
          AND tablename LIKE 'V_%'
     ORDER BY
          1
;

";
  $sth_rundq = $dbh->execute_query($onesql);
  • true
  • false

true

migrate-variables=true

  • logging-level

Logging level of Teradata Perl migration log files.

error: Log only errors.

warning: Log errors and warnings.

info: Log errors, warnings, and activity information. This level contains all log information.

  • error
  • warning
  • info

info

logging-level=info

  • log-file-count

Maximum number of log files retained, including the log files in use and archived log files.

If the number of log files exceeds the upper limit, the earliest files will be deleted until the new log files are successfully archived.

3 - 10

5

log-file-count=10

  • log-file-size

Maximum file size.

Upon reaching the specified size, a file is archived by adding a timestamp to the file name.

Example:

perlDSC_2018-07-08_16_12_08.log

After the archiving, a new log file perlDSC.log with a timestamp is generated.

1MB - 10MB

5MB

log-file-size=10MB

  • migrate-executequery

Whether to enable the migration of execute_query containing SQL statements.

true: enables the migration of execute_query containing SQL statements.

false: disables the migration of execute_query containing SQL statements.

The following is an example:

migrate-executequery is set to true and input is as follows:

1
2
my $rows1=$conn1->execute_query("sel ${selectclause} from ${databasename}.${tablename};
         ");

Output

1
2
3
4
5
my $rows1=$conn1->execute_query("SELECT
          ${selectclause}
     FROM
          ${databasename}.${tablename}
;");
  • true
  • false

true

migrate-executequery =true