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:
get_commit()[source]

Returns the underlying commit referenced by this reference id

Raises:
Return type:

Commit

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:
merge_into(destination_branch, **kwargs)[source]

Merge this reference into destination branch

Parameters:
  • destination_branch (Union[str, Reference, Commit]) – The merge destination (either ID or branch object)

  • kwargs – Additional Keyword Arguments to send to the server

Return type:

str

Returns:

The reference id of the merge commit

Raises:
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:

StoredObject

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:
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 generate

  • kwargs – The function kwargs

Returns:

A generator based on the listing function