Teradata Package for Python Function Reference | 20.00 - 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 - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- Enterprise
- IntelliFlex
- VMware
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.table_operators.Script.install_file = install_file(self, file_identifier, file_name, is_binary=False, replace=False, force_replace=False)
- DESCRIPTION:
Function to install script on Vantage.
On success, prints a message that file is installed.
This language script can be executed via execute_script() function.
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_name:
Required Argument:
Specifies the name of the file user wnats to install.
Types: str
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 value the 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
RETURNS:
True, if success
RAISES:
TeradataMLException.
EXAMPLES:
# Note - Refer to User Guide for setting search path and required permissions.
# Example 1: Install the file mapper.py found at the relative path
# data/scripts/ using the default text mode.
# Set SEARCHUIFDBPATH.
>>> execute_sql("SET SESSION SEARCHUIFDBPATH = alice;")
# Create a Script object that allows us to execute script on Vantage.
>>> import os
>>> from teradatasqlalchemy import VARCHAR
>>> td_path = os.path.dirname(teradataml.__file__)
>>> sto = Script(data=barrierdf,
... script_name='mapper.py',
... files_local_path= os.path.join(td_path, 'data', "scripts"),
... script_command='tdpython3 ./alice/mapper.py',
... data_order_column="Id",
... is_local_order=False,
... nulls_first=False,
... sort_ascending=False,
... charset='latin',
... returns=OrderedDict([("word", VARCHAR(15)),("count_input", VARCHAR(2))]))
>>>
# Install file on Vantage.
>>> sto.install_file(file_identifier='mapper',
... file_name='mapper.py',
... is_binary=False)
File mapper.py installed in Vantage
# Replace file on Vantage.
>>> sto.install_file(file_identifier='mapper',
... file_name='mapper.py',
... is_binary=False,
... replace=True,
... force_replace=True)
File mapper.py replaced in Vantage