remove_file | Manage files & libs in User Environment | Open Analytics Framework - remove_file - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798

Use the remove_file function to remove specified file from remote user environment.

Required Argument

file_name
Specifies the file name to be removed.
If the file has an extension, specify the filename with extension.

Optional Argument

**kwargs: Specifies the keyword arguments.

suppress_output
Specifies whether to print the output message.
Default value is False. When set to True, the output message is not printed.

This function returns True, if the operation is successful.

Example Prerequisite

  • Create a Python 3.7.3 environment with given name and description in Vantage.
    >> env = create_env('testenv', 'python_3.7.9', 'Test environment')
    User environment 'testenv' created.
  • Install the file "mapper.py" using the default text mode in the remote user environment.
    >>> import os, teradataml
    >>> file_path = os.path.join(os.path.dirname(teradataml.__file__), "data", "scripts", "mapper.py")
    >>> env.install_file(file_path = file_path)
        File 'mapper.py' replaced successfully in the remote user environment 'testenv'.
  • Create conda environment.
    >>> testenv_conda = create_env('testenv_conda', 'python_3.8', 'Test conda environment', conda_env=True)
    Conda environment creation initiated
    User environment 'testenv_conda' created.
  • Install the file mapper.py in the 'testenv_conda' environment.
    >>> import os, teradataml
    >>> file_path = os.path.join(os.path.dirname(teradataml.__file__), "data", "scripts", "mapper.py")
    >>> testenv_conda.install_file(file_path = file_path)
    File 'mapper.py' installed successfully in the remote user environment 'testenv_conda'.

Example 1: Remove file from remote user environment

>>> env.remove_file('mapper.py')
File 'mapper.py' removed successfully from the remote user environment 'testenv'.

Example 2: Remove file from remote conda user environment

>>> testenv_conda.remove_file('mapper.py')
File 'mapper.py' removed successfully from the remote user environment 'testenv_conda'.
Remove the environment.
>>> remove_env('testenv')
User environment 'testenv' removed.
>>> remove_env('testenv_conda')
User environment 'testenv_conda' removed.