File Management

These dataclasses are used in the SDK to represent API requests and responses for services in the databricks.sdk.service.files module.

class databricks.sdk.service.files.AddBlock
handle: int

The handle on an open stream.

data: str

The base64-encoded data to append to the stream. This has a limit of 1 MB.

as_dict() dict

Serializes the AddBlock into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) AddBlock

Deserializes the AddBlock from a dictionary.

class databricks.sdk.service.files.AddBlockResponse
as_dict() dict

Serializes the AddBlockResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) AddBlockResponse

Deserializes the AddBlockResponse from a dictionary.

class databricks.sdk.service.files.Close
handle: int

The handle on an open stream.

as_dict() dict

Serializes the Close into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) Close

Deserializes the Close from a dictionary.

class databricks.sdk.service.files.CloseResponse
as_dict() dict

Serializes the CloseResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) CloseResponse

Deserializes the CloseResponse from a dictionary.

class databricks.sdk.service.files.Create
path: str

The path of the new file. The path should be the absolute DBFS path.

overwrite: bool | None = None

The flag that specifies whether to overwrite existing file/files.

as_dict() dict

Serializes the Create into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) Create

Deserializes the Create from a dictionary.

class databricks.sdk.service.files.CreateDirectoryResponse
as_dict() dict

Serializes the CreateDirectoryResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) CreateDirectoryResponse

Deserializes the CreateDirectoryResponse from a dictionary.

class databricks.sdk.service.files.CreateResponse
handle: int | None = None

Handle which should subsequently be passed into the AddBlock and Close calls when writing to a file through a stream.

as_dict() dict

Serializes the CreateResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) CreateResponse

Deserializes the CreateResponse from a dictionary.

class databricks.sdk.service.files.Delete
path: str

The path of the file or directory to delete. The path should be the absolute DBFS path.

recursive: bool | None = None

Whether or not to recursively delete the directory’s contents. Deleting empty directories can be done without providing the recursive flag.

as_dict() dict

Serializes the Delete into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) Delete

Deserializes the Delete from a dictionary.

class databricks.sdk.service.files.DeleteDirectoryResponse
as_dict() dict

Serializes the DeleteDirectoryResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) DeleteDirectoryResponse

Deserializes the DeleteDirectoryResponse from a dictionary.

class databricks.sdk.service.files.DeleteResponse
as_dict() dict

Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) DeleteResponse

Deserializes the DeleteResponse from a dictionary.

class databricks.sdk.service.files.DirectoryEntry
file_size: int | None = None

The length of the file in bytes. This field is omitted for directories.

is_directory: bool | None = None

True if the path is a directory.

last_modified: int | None = None

Last modification time of given file in milliseconds since unix epoch.

name: str | None = None

The name of the file or directory. This is the last component of the path.

path: str | None = None

The absolute path of the file or directory.

as_dict() dict

Serializes the DirectoryEntry into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) DirectoryEntry

Deserializes the DirectoryEntry from a dictionary.

class databricks.sdk.service.files.DownloadResponse
content_length: int | None = None
content_type: str | None = None
contents: BinaryIO | None = None
last_modified: str | None = None
as_dict() dict

Serializes the DownloadResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) DownloadResponse

Deserializes the DownloadResponse from a dictionary.

class databricks.sdk.service.files.FileInfo
file_size: int | None = None

The length of the file in bytes. This field is omitted for directories.

is_dir: bool | None = None

True if the path is a directory.

modification_time: int | None = None

Last modification time of given file in milliseconds since epoch.

path: str | None = None

The absolute path of the file or directory.

as_dict() dict

Serializes the FileInfo into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) FileInfo

Deserializes the FileInfo from a dictionary.

class databricks.sdk.service.files.GetDirectoryMetadataResponse
as_dict() dict

Serializes the GetDirectoryMetadataResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) GetDirectoryMetadataResponse

Deserializes the GetDirectoryMetadataResponse from a dictionary.

class databricks.sdk.service.files.GetMetadataResponse
content_length: int | None = None
content_type: str | None = None
last_modified: str | None = None
as_dict() dict

Serializes the GetMetadataResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) GetMetadataResponse

Deserializes the GetMetadataResponse from a dictionary.

class databricks.sdk.service.files.ListDirectoryResponse
contents: List[DirectoryEntry] | None = None

Array of DirectoryEntry.

next_page_token: str | None = None

A token, which can be sent as page_token to retrieve the next page.

as_dict() dict

Serializes the ListDirectoryResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) ListDirectoryResponse

Deserializes the ListDirectoryResponse from a dictionary.

class databricks.sdk.service.files.ListStatusResponse
files: List[FileInfo] | None = None

A list of FileInfo’s that describe contents of directory or file. See example above.

as_dict() dict

Serializes the ListStatusResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) ListStatusResponse

Deserializes the ListStatusResponse from a dictionary.

class databricks.sdk.service.files.MkDirs
path: str

The path of the new directory. The path should be the absolute DBFS path.

as_dict() dict

Serializes the MkDirs into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) MkDirs

Deserializes the MkDirs from a dictionary.

class databricks.sdk.service.files.MkDirsResponse
as_dict() dict

Serializes the MkDirsResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) MkDirsResponse

Deserializes the MkDirsResponse from a dictionary.

class databricks.sdk.service.files.Move
source_path: str

The source path of the file or directory. The path should be the absolute DBFS path.

destination_path: str

The destination path of the file or directory. The path should be the absolute DBFS path.

as_dict() dict

Serializes the Move into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) Move

Deserializes the Move from a dictionary.

class databricks.sdk.service.files.MoveResponse
as_dict() dict

Serializes the MoveResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) MoveResponse

Deserializes the MoveResponse from a dictionary.

class databricks.sdk.service.files.Put
path: str

The path of the new file. The path should be the absolute DBFS path.

contents: str | None = None

This parameter might be absent, and instead a posted file will be used.

overwrite: bool | None = None

The flag that specifies whether to overwrite existing file/files.

as_dict() dict

Serializes the Put into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) Put

Deserializes the Put from a dictionary.

class databricks.sdk.service.files.PutResponse
as_dict() dict

Serializes the PutResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) PutResponse

Deserializes the PutResponse from a dictionary.

class databricks.sdk.service.files.ReadResponse
bytes_read: int | None = None

The number of bytes read (could be less than length if we hit end of file). This refers to number of bytes read in unencoded version (response data is base64-encoded).

data: str | None = None

The base64-encoded contents of the file read.

as_dict() dict

Serializes the ReadResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) ReadResponse

Deserializes the ReadResponse from a dictionary.

class databricks.sdk.service.files.UploadResponse
as_dict() dict

Serializes the UploadResponse into a dictionary suitable for use as a JSON request body.

classmethod from_dict(d: Dict[str, any]) UploadResponse

Deserializes the UploadResponse from a dictionary.