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

Teradata® Package for R User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
ft:locale
en-US
ft:lastEdition
2024-04-09
dita:mapPath
efv1707506846369.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
nqx1518630623256
lifecycle
latest
Product Category
Teradata Vantage

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 following 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.