Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - snapshot - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.scriptmgmt.UserEnv.UserEnv.snapshot = snapshot(self, dir=None)
DESCRIPTION:
    Take the snapshot of the user environment.
    Function stores the snapshot of the user environment in a
    JSON file, which can be used as input to re-create the exact
    same user environment by passing the snapshot file to create_env().
 
PARAMETERS:
    dir:
        Optional Argument.
        Specifies the directory path to store the snapshot file.
        Note:
            * when "dir" is not provided, function creates temporary folder
              and store the snapshot files in the temp folder.
            * While taking the snapshot, if file is installed in the enviornment,
              to re-create the exact same user environment user has to provide
              the absolute path of file to be installed in the generated snapshot
              file by replacing <ADD_YOUR_LOCAL_FILE_PATH>.
 
        Types: str
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    # Create a Python environment with name"env_1" in the Vantage.
    >>> env = create_env("env_1")
    ... User environment 'env_1' created.
 
    # Install the file mapper.py in the 'testenv' 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' installed successfully in the remote user environment 'env_1'.
    True
 
    # Install 'numpy' Python library.
    >>> env.install_lib('numpy')
                                   Claim Id  ... Additional Details
    0  fa72b8ec-429e-4a63-a6d1-598869a57bc3  ...
    1  fa72b8ec-429e-4a63-a6d1-598869a57bc3  ...
 
    # Take a snapshot of 'env_1'.
    >>> env.snapshot()
    Snapshot for environment "env_1" is stored at "...:\...\...\snapshot_env_1_python_3.10.5_1700740261.2757893.json"