util
Useful utilities for handling lakeFS URIs and results of lakeFS API calls.
depaginate ¶
depaginate(
api: Callable[..., PaginatedApiResponse], *args: Any, **kwargs: Any
) -> Generator[Any, None, None]
Unwrap the responses from a paginated lakeFS API method into a generator.
PARAMETER | DESCRIPTION |
---|---|
api |
The lakeFS client API to call. Must return a paginated response with the
TYPE:
|
*args |
Positional arguments to pass to the API call.
TYPE:
|
**kwargs |
Keyword arguments to pass to the API call.
TYPE:
|
YIELDS | DESCRIPTION |
---|---|
Any
|
The obtained API result objects. |
Source code in src/lakefs_spec/util.py
md5_checksum ¶
Calculate a local file's MD5 hash.
PARAMETER | DESCRIPTION |
---|---|
lpath |
The local path whose MD5 hash to calculate. Must be a file.
TYPE:
|
blocksize |
Block size (in bytes) to use while reading in the file.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The file's MD5 hash value, as a string. |
Source code in src/lakefs_spec/util.py
parse ¶
Parses a lakeFS URI in the form lakefs://<repo>/<ref>/<resource>
.
PARAMETER | DESCRIPTION |
---|---|
path |
String path, needs to conform to the lakeFS URI format described above.
The
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[str, str, str]
|
A 3-tuple of repository name, reference, and resource name. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the path does not conform to the lakeFS URI format. |