lakefs.reference module¶
Module containing lakeFS reference implementation
- class lakefs.reference.Reference(repository_id, reference_id, client=None)[source]¶
Bases:
_BaseLakeFSObject
Class representing a reference in lakeFS.
- diff(other_ref, max_amount=None, after=None, prefix=None, delimiter=None, **kwargs)[source]¶
Returns a diff generator of changes between this reference and other_ref
- Parameters:
other_ref – The other ref to diff against
max_amount – Stop showing changes after this amount
after – Return items after this value
prefix – Return items prefixed with this value
delimiter – Group common prefixes by this delimiter
kwargs – Additional Keyword Arguments to send to the server
- Raises:
NotFoundException – if this reference or other_ref does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- get_commit()[source]¶
Returns the underlying commit referenced by this reference id
- Raises:
NotFoundException – if this reference does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- Return type:
- property id: str¶
Returns the reference id
- log(max_amount=None, **kwargs)[source]¶
Returns a generator of commits starting with this reference id
- Parameters:
max_amount – (Optional) limits the amount of results to return from the server
kwargs – Additional Keyword Arguments to send to the server
- Raises:
NotFoundException – if reference by this id does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- merge_into(destination_branch, **kwargs)[source]¶
Merge this reference into destination branch
- Parameters:
- Return type:
str
- Returns:
The reference id of the merge commit
- Raises:
NotFoundException – if reference by this id does not exist, or branch doesn’t exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- object(path)[source]¶
Returns an Object class representing a lakeFS object with this repo id, reference id and path
- Parameters:
path (
str
) – The object’s path- Return type:
- objects(max_amount=None, after=None, prefix=None, delimiter=None, **kwargs)[source]¶
Returns an object generator for this reference, the generator can yield either a StoredObject or a CommonPrefix object depending on the listing parameters provided.
- Parameters:
max_amount (Optional[int]) – Stop showing changes after this amount
after (Optional[str]) – Return items after this value
prefix (Optional[str]) – Return items prefixed with this value
delimiter (Optional[str]) – Group common prefixes by this delimiter
kwargs – Additional Keyword Arguments to send to the server
- Raises:
NotFoundException – if this reference or other_ref does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- Return type:
Generator[StoredObject | CommonPrefix]
- property repo_id: str¶
Return the repository id for this reference
- lakefs.reference.generate_listing(func, *args, max_amount=None, **kwargs)[source]¶
Generic generator function, for lakefs-sdk listings functionality
- Parameters:
func – The listing function
args – The function args
max_amount (
Optional
[int
]) – The max amount of objects to generatekwargs – The function kwargs
- Returns:
A generator based on the listing function