td_install_file() | Teradata R Package - 17.00 - td_install_file() - Teradata R Package

Teradata® R Package User Guide

prodname
Teradata R Package
vrm_release
17.00
created_date
November 2020
category
User Guide
featnum
B700-4005-090K

The td_install_file() function installs or replaces an external language script or model file in Vantage.

On success, it prints a message stating that the file is installed or replaced.

Installed language script can be executed using td_execute_script() in Vantage.

  • Connection to Vantage must be established before using this function.
  • This function is not supported when connected to Vantage using Teradata ODBC Driver connection.
  • The file to be installed can be on client or on remote database server.

    If the file is on remote database server and file path is relative path, then the file is searched in the provided path relative to the location /etc/opt/teradata/tdconfig/Teradata/tdbs_udf/usr/ on the server.

  • Files used in the below examples are part of the package and can be found in package install location, using the following command:
    > tdplyr_install_location <- file.path(.libPaths()[1], "tdplyr")
    The .libPaths() gives a vector of locations where R packages are installed. Use the one where tdplyr is installed.

Example 1: Install a text file 'mapper.R'

> td_install_file(file.path.loc = file.path(tdplyr_install_location, "scripts", "mapper.R"), file.identifier = 'mapper')
File 'mapper' installed in Vantage.

Example 2: Install a binary file 'binary_file.dms'

> td_install_file(file.path.loc = file.path(tdplyr_install_location, "scripts", "binary_file.dms"),
                  file.identifier = 'binaryfile',
                  file.on.client = TRUE,
                  is.binary = TRUE)
File 'binaryfile' installed in Vantage.

Example 3: Replace the file 'mapper.R' with 'mapper_replace.R', found at the same tdplyr installation location

> td_install_file(file.path.loc = file.path(tdplyr_install_location, "scripts", "mapper_replace.R"),
                  file.identifier = 'mapper',
                  file.on.client = TRUE,
                  is.binary = FALSE,
                  replace = TRUE,
                  force.replace = TRUE)
File 'mapper' replaced in Vantage.