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:
- 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:
NotFoundException – if repository does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- 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:
- 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 namespacedefault_branch (
str
) – The default branch for the repository. If None, use server default nameinclude_samples (
bool
) – Whether to include sample data in repository creationexist_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 onekwargs – Additional Keyword Arguments to send to the server
- Return type:
- Returns:
The lakeFS SDK object representing the repository
- Raises:
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- delete()[source]¶
Delete repository from lakeFS server
- Raises:
NotFoundException – if repository by this id does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- 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:
- 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:
- 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:
NotFoundException – if repository does not exist
NotAuthorizedException – if user is not authorized to perform this operation
ServerException – for any other errors
- 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