files.utils
cloud.files.utils
Functions
Name | Description |
---|---|
basename_match | Checks if the basename of a given file uri matches |
create_file | Creates a TileDB file at the specified location |
export_file | Exports a TileDB File back to its original file format |
export_file_local | Exports a TileDB File back to its original file format |
sanitize_filename | Sanitizes a filename by removing invalid characters. |
upload_file | Uploads a file to TileDB Cloud. |
basename_match
=None) cloud.files.utils.basename_match(file_uri, pattern
Checks if the basename of a given file uri matches the given UNIX shell style pattern.
Parameters
Name | Type | Description | Default |
---|---|---|---|
file_uri | str | A file URI. | required |
pattern | Optional[str] | A UNIX shell style pattern, defaults to None | None |
Returns
Name | Type | Description |
---|---|---|
bool | Pattern matches the file basename or not. |
create_file
cloud.files.utils.create_file(
namespace
input_uri
output_uri=None
name=None
access_credentials_name=None
access_credential_name=False
async_req )
Creates a TileDB file at the specified location
Parameters
Name | Type | Description | Default |
---|---|---|---|
namespace | str | namespace the create file operation belongs to | required |
name | Optional[str] | name to use for registration in TileDB Cloud | None |
input_uri | str | input file uri | required |
output_uri | str | output array uri | required |
access_credential_name | Optional[str] | DEPRECATED. Use access_credential_name instead. |
None |
access_credentials_name | Optional[str] | optional access credentials to use | None |
async_req | bool | return future instead of results for async support | False |
Returns
Name | Type | Description |
---|---|---|
models.FileCreated | FileCreated details, including file_uuid and output_uri |
export_file
=False) cloud.files.utils.export_file(uri, output_uri, async_req
Exports a TileDB File back to its original file format
Parameters
Name | Type | Description | Default |
---|---|---|---|
uri | str | The tiledb://... URI of the file to export |
required |
output_uri | str | output file uri | required |
async_req | bool | return future instead of results for async support | False |
Returns
Name | Type | Description |
---|---|---|
models.FileExported | FileExported details, including output_uri |
export_file_local
cloud.files.utils.export_file_local(
uri
output_uri=None
timestamp=False
async_req )
Exports a TileDB File back to its original file format
Parameters
Name | Type | Description | Default |
---|---|---|---|
uri | str | The tiledb://... URI of the file to export |
required |
output_uri | str | output file uri | required |
timestamp | tuple | (default None) If int, open the array at a given TileDB timestamp. If tuple, open at the given start and end TileDB timestamps. | None |
async_req | bool | return future instead of results for async support | False |
Returns
Name | Type | Description |
---|---|---|
models.FileExported | FileExported details, including output_uri |
sanitize_filename
cloud.files.utils.sanitize_filename(fname)
Sanitizes a filename by removing invalid characters.
Parameters
Name | Type | Description | Default |
---|---|---|---|
fname | str | A filename to sanitize | required |
Returns
Name | Type | Description |
---|---|---|
str | The sanitized string |
upload_file
cloud.files.utils.upload_file(
input_uri
output_uri*
=None
filename='application/octet-stream'
content_type=None
access_credentials_name )
Uploads a file to TileDB Cloud.
Parameters
Name | Type | Description | Default |
---|---|---|---|
input_uri | str | The URI or path of the input file. May be an ordinary path or any URI accessible via TileDB VFS. | required |
output_uri | str | The TileDB URI to write the file to. | required |
filename | Optional[str] | If present, the value to store as the original filename. | None |
content_type | str | The MIME type of the file. | 'application/octet-stream' |
access_credentials_name | Optional[str] | If present, the name of the credentials to use when writing the uploaded file to backend storage instead of the defaults. | None |
Returns
Name | Type | Description |
---|---|---|
str | The tiledb:// URI of the uploaded file. |