FileService
FileService(tm1_rest)
Bases: ObjectService
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tm1_rest
|
RestService
|
|
required |
Source code in TM1py/Services/FileService.py
MPU_REQUIRED_VERSION = '12'
class-attribute
instance-attribute
SUBFOLDER_REQUIRED_VERSION = '12'
class-attribute
instance-attribute
version_content_path = 'Files'
instance-attribute
create(file_name, file_content, multi_part_upload=None, max_mb_per_part=200, max_workers=1, **kwargs)
Create file
Folders in file_name (e.g. folderA/folderB/file.csv) will be created implicitly
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Union[str, Path]
|
file name in root or path to file |
required |
file_content
|
Union[bytes, BytesIO]
|
file_content as bytes or BytesIO |
required |
multi_part_upload
|
bool
|
boolean use multipart upload or not (only available from TM1 12 onwards) By default, multi_part_upload is used for TM1 v12 and not used for TM1 v11 |
None
|
max_mb_per_part
|
float
|
max megabyte per part in multipart upload (only available from TM1 12 onwards) |
200
|
max_workers
|
int
|
max parallel workers for multipart upload (only available from TM1 12 onwards) |
1
|
Source code in TM1py/Services/FileService.py
delete(file_name, **kwargs)
Delete file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Union[str, Path]
|
file name in root or path to file |
required |
Source code in TM1py/Services/FileService.py
exists(file_name, **kwargs)
Check if file exists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Union[str, Path]
|
file name in root or path to file |
required |
Source code in TM1py/Services/FileService.py
get(file_name, **kwargs)
Get file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
file name in root or path to file |
required |
Source code in TM1py/Services/FileService.py
get_all_names(path='', **kwargs)
return list of blob file names
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, Path]
|
path to folder. When empty searches in root |
''
|
Source code in TM1py/Services/FileService.py
get_names(**kwargs)
Source code in TM1py/Services/FileService.py
search_string_in_name(name_startswith=None, name_contains=None, name_contains_operator='and', path='', **kwargs)
Return list of blob files that match search critera
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_startswith
|
str
|
str, file name begins with (case insensitive) |
None
|
name_contains
|
Iterable
|
iterable, found anywhere in name (case insensitive) |
None
|
name_contains_operator
|
str
|
'and' or 'or' |
'and'
|
path
|
Union[Path, str]
|
search in given path or root |
''
|
Source code in TM1py/Services/FileService.py
update(file_name, file_content, multi_part_upload=None, max_mb_per_part=200, max_workers=1, **kwargs)
Update existing file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Union[str, Path]
|
file name in root or path to file |
required |
file_content
|
Union[bytes, BytesIO]
|
file_content as bytes or BytesIO |
required |
multi_part_upload
|
bool
|
boolean use multipart upload or not (only available from TM1 12 onwards) By default, multi_part_upload is used for TM1 v12 and not used for TM1 v11 |
None
|
max_mb_per_part
|
float
|
max megabyte per part in multipart upload (only available from TM1 12 onwards) |
200
|
max_workers
|
int
|
max parallel workers for multipart upload (only available from TM1 12 onwards) |
1
|
Source code in TM1py/Services/FileService.py
update_or_create(file_name, file_content, multi_part_upload=None, max_mb_per_part=200, max_workers=1, **kwargs)
Create file or update file if it already exists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
Union[str, Path]
|
file name in root or path to file |
required |
file_content
|
bytes
|
file_content as bytes or BytesIO |
required |
multi_part_upload
|
bool
|
boolean use multipart upload or not (only available from TM1 12 onwards). By default, multi_part_upload is used for TM1 v12 and not used for TM1 v11 |
None
|
max_mb_per_part
|
float
|
max megabyte per part in multipart upload (only available from TM1 12 onwards) |
200
|
max_workers
|
int
|
max parallel workers for multipart upload (only available from TM1 12 onwards) |
1
|