Teradata Package for Python Function Reference - install_file - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage
filemgr.install_file = install_file(file_identifier, file_path, file_on_client=True, is_binary=False, replace=False, force_replace=False)
DESCRIPTION:
    Function installs or replaces external language script or model files in Vantage.
    On success, prints a message that file is installed or replaced.
    This language script can be executed via execute_script() method in Script.
 
PARAMETERS:
    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: str
 
    file_path:
        Required Argument.
        Specifies the absolute/relative path of file (including file name) to be installed.
        This file is identified in Vantage by file_identifier.
        Types: str
 
    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: bool
 
    is_binary:
        Optional Argument.
        Specifies if file to be installed is a binary file.
        Default Value: False
        Types: bool
 
    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.
        If set to False, then the file is installed.
        Default Value: False
        Types: bool
 
    force_replace:
        Optional Argument.
        Specifies if system should check for the file being used before replacing it.
        If set to True, then the file is replaced even if it is being executed.
        If set to False, then an error is thrown if it is being executed.
        Default Value: False
        Types: bool
        Note:
            This argument is ignored if replace is set to False.
 
RETURNS:
     True, if success.
 
RAISES:
    TeradataMLException.
 
EXAMPLES:
    # Note: File can be on client or remote server. The file location should be specified accordingly.
    # Example 1: Install the file mapper.py found at the relative path data/scripts/ using
    #            the default text mode.
    >>> install_file (file_identifier='mapper', file_location='data/scripts/mapper.py')
    File mapper.py installed in Vantage
 
    # Example 2: Install the file binary_file.dms found at the relative path data/scripts/
    #            using the binary mode.
    >>> install_file (file_identifier='binaryfile', file_location='data/scripts/binary_file.dms', file_on_client = True, is_binary = True)
    File binary_file.dms installed in Vantage
 
    # Example 3: Replace the file mapper.py with mapper_replace.py found at the relative path data/scripts/
    #            using the default text mode.
    >>> install_file (file_identifier='mapper', file_location='data/scripts/mapper_replace.py', file_on_client=True, is_binary= False, replace=True, force_replace=True)
    File mapper_replace.py replaced in Vantage