Teradata Package for Python Function Reference - remove_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
- teradataml.table_operators.Script.remove_file = remove_file(self, file_identifier, force_remove=False)
- DESCRIPTION:
Function to remove user installed files/scripts from Vantage.
PARAMETERS:
file_identifier:
Required Argument.
Specifies the name associated with the user-installed file.
It cannot have a database name associated with it,
as the file is always installed in the current database.
Types: str
force_remove:
Required Argument.
Specifies if system should check for the file being used before
removing it.
If set to True, then the file is removed 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.
# Run install_file example before removing file.
# Set SEARCHUIFDBPATH.
>>> get_context().execute("SET SESSION SEARCHUIFDBPATH = alice;")
# Create a Script object that allows us to execute script on Vantage.
>>> sto = Script(data=barrierdf,
... script_name='mapper.py',
... files_local_path= os.path.join(td_path, 'data', "scripts"),
... script_command='python ./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,
... replace=True,
... force_replace=True)
File mapper.py replaced in Vantage
# Remove the installed file.
>>> sto.remove_file(file_identifier='mapper', force_remove=True)
File mapper removed from Vantage