Teradata R Package Function Reference | 17.00 - 17.00 - td_install_file - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

Description

This function installs or replaces external language script or model file in Vantage. On success, it prints a message that the file is installed or replaced.
Note: This function is not supported with ODBC driver connection.

Usage

td_install_file(
  file.path.loc = NULL,
  file.identifier = NULL,
  file.on.client = TRUE,
  is.binary = FALSE,
  replace = FALSE,
  force.replace = FALSE,
  ...
)

Arguments

file.path.loc

Required Argument.
Specifies the absolute/relative path of the file (including file name) to be installed.
This file is identified in Vantage by "file.identifier".
Types: character

file.identifier

Required Argument.
Specifies the name associated with the user-installed file.
It cannot have a schema name associated with it, as the file is always installed in the current schema.
The name should be unique within the schema. It can be any valid Teradata identifier.
Types: character

file.on.client

Optional Argument.
Specifies whether the file is present on client or remote location on Vantage.
Set this to FALSE if the file to be installed is present at remote location on Vantage.
Default Value: TRUE
Types: logical

is.binary

Optional Argument.
Specifies if file to be installed is a binary file.
Default Value: FALSE
Types: logical

replace

Optional Argument.
Specifies if the file is to be installed or replaced.
If set to TRUE, then the file is replaced based on the value of "force.replace" argument.
Default Value: FALSE
Types: logical

force.replace

Optional Argument.
Specifies whether the file is to be replaced even if it is being executed.
If set to TRUE, the file is replaced even if it is being executed.
If set to FALSE, an error is raised if it is being executed.
Note: This argument is ignored if the argument "replace" is set to FALSE.
Default Value: FALSE
Types: logical

...

Any additional parameters required for the function.

Value

None. Prints message if the operation is successful.

See Also

td_remove_file

Examples

# Note:
#  1. Connection must be established before running these examples.
#  2. File can be on client or remote database server.
#  3. Files mentioned in the examples are part of the package and can be found at
#     package install location as shown in the below examples.

# Replace "<tdplyr_install_location>" with the absolute path of the install location of the
# tdplyr library. One can get this location using '.libPaths()'.
# Make sure to include 'tdplyr' in the path. For example, <r_pkg_install_location>/tdplyr.

tdplyr_install_location <- "<tdplyr_install_location>"

# Example 1: Install the file 'mapper.R' found at the path mentioned in "file.path.loc"
#            argument.
td_install_file(file.path.loc = file.path(tdplyr_install_location, "scripts", "mapper.R"),
                file.identifier = 'mapper')

# Example 2: Install the binary file 'binary_file.dms' found at the path mentioned in
#            "file.path.loc" argument.
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)

# Example 3: Replace the file 'mapper.R' with 'mapper_replace.R' found at the path mentioned
#            in "file.path.loc" argument.
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)