copy_files_from_container() | Sandbox Container Utility | teradataml - copy_files_from_container() - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2022-01-14
dita:mapPath
bol1585763678431.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

Use the copy_files_from_container() function to copy files from a container to local file system.

Files are copied to a directory under the .teradataml directory in user's home directory. User is responsible for cleaning up this directory.

The container can be specified by the argument container_id or indicated by configure.sandbox_container_id.

See sandbox_container_id for details about this teradataml configuration option.

Required argument:
  • files_to_copy specifies the names of the files to be copied from a container.
    The files to be copied should be in the /home/tdatuser directory inside the container.
Optional argument:
  • container_id specifies the container from which files are to be copied.

    If this argument is not specified, then files are copied from the container indicated in configure.sandbox_container_id.

Example 1: Copy a single file

This example copies a single file from /home/tdatuser inside a container started by teradataml to local host.

  1. Import required module.
    >>> from teradataml.table_operators.sandbox_container_util import copy_files_from_container
  2. Copy a file from the container indicated in configure.sandbox_container_id.
    >>> copy_files_from_container(files_to_copy="file1.txt")
        Files copied to: /<user's home directory>/.teradataml/files_from_container_210110_19394

Example 2: Copy multiple files

This example copies multiple files from /home/tdatuser inside a container started by teradataml to local host.

  1. Import required module.
    >>> from teradataml.table_operators.sandbox_container_util import copy_files_from_container
  2. Copy a file from the container indicated in configure.sandbox_container_id.
    >>> copy_files_from_container(files_to_copy=["output/file1.txt", "file2.txt"])
        Files copied to: /<user's home directory>/.teradataml/files_from_container_210110_19394