lakefs.repository module

Module containing lakeFS repository implementation

class lakefs.repository.Repository(repository_id, client=None)[source]

Bases: _BaseLakeFSObject

Class representing a Repository in lakeFS. The Repository object provides the context for the other objects that are found in it. Access to these objects should be done from this class

branch(branch_id)[source]

Return a branch object using the current repository id and client :type branch_id: str :param branch_id: name of the branch

Return type:

Branch

branches(max_amount=None, after=None, prefix=None, **kwargs)[source]

Returns a generator listing for branches on the given repository

Parameters:
  • max_amount – Stop showing changes after this amount

  • after – Return items after this value

  • prefix – Return items prefixed with this value

  • kwargs – Additional Keyword Arguments to send to the server

Raises:
commit(commit_id)[source]

Return a reference object using the current repository id and client :type commit_id: str :param commit_id: id of the commit reference

Return type:

Reference

create(storage_namespace, default_branch='main', include_samples=False, exist_ok=False, **kwargs)[source]

Create a new repository in lakeFS from this object

Parameters:
  • storage_namespace (str) – Repository’s storage namespace

  • default_branch (str) – The default branch for the repository. If None, use server default name

  • include_samples (bool) – Whether to include sample data in repository creation

  • exist_ok (bool) – If False will throw an exception if a repository by this name already exists. Otherwise, return the existing repository without creating a new one

  • kwargs – Additional Keyword Arguments to send to the server

Return type:

Repository

Returns:

The lakeFS SDK object representing the repository

Raises:
delete()[source]

Delete repository from lakeFS server

Raises:
Return type:

None

property id: str

Returns the repository’s id

property metadata: dict[str, str]

Returns the repository metadata

property properties: RepositoryProperties

Return the repository’s properties object

ref(ref_id)[source]

Return a reference object using the current repository id and client :type ref_id: str :param ref_id: branch name, commit id or tag id

Return type:

Reference

tag(tag_id)[source]

Return a tag object using the current repository id and client :type tag_id: str :param tag_id: name of the tag

Return type:

Tag

tags(max_amount=None, after=None, prefix=None, **kwargs)[source]

Returns a generator listing for tags on the given repository

Parameters:
  • max_amount – Stop showing changes after this amount

  • after – Return items after this value

  • prefix – Return items prefixed with this value

  • kwargs – Additional Keyword Arguments to send to the server

Raises:
lakefs.repository.repositories(client=None, prefix=None, after=None, **kwargs)[source]

Creates a repositories object generator listing lakeFS repositories

Parameters:
  • client – The lakeFS client to use, if None, tries to use the default client

  • prefix – Return items prefixed with this value

  • after – Return items after this value

Returns:

A generator listing lakeFS repositories