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.
- 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.
- 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.
- Import required module.
>>> from teradataml.table_operators.sandbox_container_util import copy_files_from_container
- 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.
- Import required module.
>>> from teradataml.table_operators.sandbox_container_util import copy_files_from_container
- 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