Client
- class hdfs_native.Client(url: str | None = None, config: Dict[str, str] | None = None)
Bases:
objectMethods Summary
append(path)Opens an existing file to append to at path
create(path[, write_options])Creates a new file and opens it for writing at path
delete(path[, recursive])Deletes a file or directory at path.
get_acl_status(path)Get the ACL status for the file or directory at path.
get_content_summary(path)Gets a content summary for path
get_file_info(path)Gets the file status for the file at path
list_status(path[, recursive])Gets the status of files rooted at path.
mkdirs(path[, permission, create_parent])Creates a directory at path with unix permissions permission.
modify_acl_entries(path, entries)Update ACL entries for file or directory at path.
read(path)Opens a file for reading at path
remove_acl(path)Remove all ACL entries for file or directory at path.
remove_acl_entries(path, entries)Remove specific ACL entries for file or directory at path.
remove_default_acl(path)Remove all default ACLs for file or directory at path.
rename(src, dst[, overwrite])Moves a file or directory from src to dst.
set_acl(path, entries)Override all ACL entries for file or directory at path.
set_owner(path[, owner, group])Sets the owner and/or group for the file at path
set_permission(path, permission)Sets the permissions for file at path to the octal value permission.
set_replication(path, replication)Sets the replication for file at path to replication
set_times(path, mtime, atime)Changes the modification time and access time of the file at path to mtime and atime, respectively.
Methods Documentation
- append(path: str) FileWriter
Opens an existing file to append to at path
- create(path: str, write_options: WriteOptions | None = None) FileWriter
Creates a new file and opens it for writing at path
- delete(path: str, recursive: bool = False) bool
Deletes a file or directory at path. If recursive is True and the target is a directory, this will delete all contents underneath the directory. If recursive is False and the target is a non-empty directory, this will fail.
- get_content_summary(path: str) ContentSummary
Gets a content summary for path
- get_file_info(path: str) FileStatus
Gets the file status for the file at path
- list_status(path: str, recursive: bool = False) Iterator[FileStatus]
Gets the status of files rooted at path. If recursive is true, lists all files recursively.
- mkdirs(path: str, permission: int = 493, create_parent: bool = False) None
Creates a directory at path with unix permissions permission. If create_parent is true, any parent directories that don’t exist will also be created. Otherwise this will fail if all parent directories don’t already exist.
- modify_acl_entries(path: str, entries: List[AclEntry]) None
Update ACL entries for file or directory at path. Existing entries will remain.
- read(path: str) FileReader
Opens a file for reading at path
- remove_acl(path: str) None
Remove all ACL entries for file or directory at path.
- remove_acl_entries(path: str, entries: List[AclEntry]) None
Remove specific ACL entries for file or directory at path.
- remove_default_acl(path: str) None
Remove all default ACLs for file or directory at path.
- rename(src: str, dst: str, overwrite: bool = False) None
Moves a file or directory from src to dst. If overwrite is True, the destination will be overriden if it already exists, otherwise the operation will fail if the destination exists.
- set_acl(path: str, entries: List[AclEntry]) None
Override all ACL entries for file or directory at path. If only access ACLs are provided, default ACLs are maintained. Likewise if only default ACLs are provided, access ACLs are maintained.
- set_owner(path: str, owner: str | None = None, group: str | None = None) None
Sets the owner and/or group for the file at path
- set_permission(path: str, permission: int) None
Sets the permissions for file at path to the octal value permission. For example, to set “rw-r–r–” Unix style permissions, use permission=0o644.
- set_replication(path: str, replication: int) bool
Sets the replication for file at path to replication
- set_times(path: str, mtime: int, atime: int) None
Changes the modification time and access time of the file at path to mtime and atime, respectively.