Class GPUdbFileHandler
- class gpudb.GPUdbFileHandler(db: GPUdb)[source]
This class exposes convenience methods to upload/download files to/from KIFS from local/KIFS directory.
Methods
upload_files - Upload a list of files -
upload_files()
upload_file - Upload a single file -
upload_file()
download_files - Download a list of files -
download_files()
download_file - Download a single file -
download_file()
Example
file_handler = GPUdbFileHandler.from_url_info(host = "http://127.0.0.1.2:9191", username="user", password="password") file_handler.upload_file(file_name="/home/user/some_file_name", kifs_path="~anonymous") file_handler.download_file(file_name="~anonymous/some_file_name", local_dir="/home/user/download")
Initialize a
GPUdbFileHandler
.Parameters
- db (GPUdb) –
A
GPUdb
instance
- classmethod from_url_info(host: str = 'http://127.0.0.1:9191', username: str = None, password: str = None)[source]
Create a
GPUdbFileHandler
instance from a host URL, user name, and password.Parameters
- host (str, optional) –
A Kinetica host URL. Defaults to “http://127.0.0.1:9191”.
- username (str, optional) –
Kinetica user name. Defaults to None.
- password (str, optional) –
Password for the user. Defaults to None.
Returns
- GPUdbFileHandler –
a
GPUdbFileHandler
instance
- classmethod from_db_instance(db: GPUdb)[source]
Create a
GPUdbFileHandler
from aGPUdb
instance.Parameters
- db (GPUdb) –
a
GPUdb
instance
Returns
- GPUdbFileHandler –
a
GPUdbFileHandler
instance
- upload_file(file_name: str, kifs_path: str) None [source]
Upload a single file to a KIFS directory.
Parameters
- file_name (str) –
Full path to the local file to upload
- kifs_path (str) –
A KIFS directory to upload (must be existing)
- upload_files(file_names: list, kifs_path: str) None [source]
Upload a list of files to a KIFS directory.
Parameters
- file_names (list) –
List of full local file paths
- kifs_path (str) –
Name of an existent KIFS directory
- download_file(file_name: str, local_dir: str) None [source]
- Download a single file to a local directory.
A large file greater than 60MB in size will be downloaded in parts.
Parameters
- file_name (str) –
Name of the file to download (full KIFS path)
- local_dir (str) –
Name of the local directory to save the file in
Raises
- gpudb.GPUdbException –
In case of an exception thrown by the server or in case the local directory doesn’t exist
- download_files(file_names: list, local_dir: str) None [source]
Download a list of files from KIFS.
Parameters
- file_names (list) –
A list of file names (full KIFS paths)
- local_dir (str) –
Name of the local directory to save the files in
Raises
- gpudb.GPUdbException –
In case of an exception thrown by the server or in case the local directory doesn’t exist