client
The Client module contains the main classes used to interact with the Arraylake service.
For asyncio interaction, use the AsyncClient
. For regular, non-async interaction, use the Client
.
Example usage:
from arraylake import Client
client = Client()
repo = client.get_repo("my-org/my-repo")
AsyncClient
Asyncio Client for interacting with ArrayLake
Arguments:
service_uri
str - [Optional] The service URI to target.token
str - [Optional] API token for service account authentication.
list_repos
async def list_repos(org: str) -> Sequence[RepoModel]
List all repositories for the specified org
Arguments:
org
- Name of the org
get_repo_object
async def get_repo_object(name: str)
Get the repo configuration object.
See get_repo
for an instantiated repo including chunkstore.
get_repo
async def get_repo(name: str,
*,
checkout: bool = True,
read_only: bool = False) -> AsyncRepo
Get a repo by name
Arguments:
name
- Full name of the repo (of the form [ORG]/[REPO])checkout
- Automatically checkout the repo after instantiation.read_only
- Open the repo in read-only mode.
get_or_create_repo
async def get_or_create_repo(
name: str,
*,
checkout: bool = True,
bucket_config_nickname: Optional[str] = None) -> AsyncRepo
Get a repo by name. Create the repo if it doesn't already exist.
Arguments:
name
- Full name of the repo (of the form [ORG]/[REPO])bucket_config_nickname
- the created repo will use this bucket for its chunks. If the repo exists, bucket_config_nickname is ignored.checkout
- Automatically checkout the repo after instantiation. If the repo does not exist, checkout is ignored.
create_repo
async def create_repo(
name: str,
*,
bucket_config_nickname: Optional[str] = None) -> AsyncRepo
Create a new repo
Arguments:
name
- Full name of the repo to create (of the form [ORG]/[REPO])bucket_config_nickname
- An optional bucket to use for the chunkstore
delete_repo
async def delete_repo(name: str,
*,
imsure: bool = False,
imreallysure: bool = False) -> None
Delete a repo
Arguments:
name
- Full name of the repo to delete (of the form [ORG]/[REPO]) imsure, imreallysure: confirm you intend to delete this bucket config
create_bucket_config
async def create_bucket_config(
*,
org: str,
nickname: str,
uri: str,
extra_config: dict | None = None,
auth_config: dict | None = None) -> BucketResponse
Create a new bucket config entry
NOTE: This does not create any actual buckets in the object store.
Arguments:
org
- Name of the orgnickname
- bucket nickname (example: ours3-bucket`)uri
- The URI of the object store, of the form platform://bucket_name[/prefix].extra_config
- dictionary of additional config to set on bucket configauth_config
- dictionary of auth parameters, must include "method" key, default is{"method": "anonymous"}
set_default_bucket_config
async def set_default_bucket_config(*, org: str, nickname: str) -> None
Set the organization's default bucket for any new repos
Arguments:
nickname
- Nickname of the bucket config to set as default.
get_bucket_config
async def get_bucket_config(*, org: str, nickname: str) -> BucketResponse
Get a bucket's configuration
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket config to retrieve.
list_bucket_configs
async def list_bucket_configs(org: str) -> list[BucketResponse]
List all bucket config entries
Arguments:
org
- Name of the organization.
list_repos_for_bucket_config
async def list_repos_for_bucket_config(*, org: str,
nickname: str) -> list[RepoModel]
List repos using a given bucket
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket configuration.
delete_bucket_config
async def delete_bucket_config(*,
org: str,
nickname: str,
imsure: bool = False,
imreallysure: bool = False) -> None
Delete a bucket config entry
NOTE: If a bucket config is in use by one or more repos, it cannot be deleted. This does not actually delete any buckets in the object store.
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket config to delete. imsure, imreallysure: confirm you intend to delete this bucket config
login
async def login(*, org: str | None = None, browser: bool = False) -> None
Login to ArrayLake
Arguments:
org
- Name of the org (only required if your default organization uses SSO)browser
- if True, open the browser to the login page
logout
async def logout(*, org: str | None = None, browser: bool = False) -> None
Log out of ArrayLake
Arguments:
org
- Name of the org (only required if your default organization uses SSO)browser
- if True, open the browser to the logout page
Client
Client for interacting with ArrayLake.
Arguments:
service_uri
str - [Optional] The service URI to target.token
str - [Optional] API token for service account authentication.
list_repos
def list_repos(org: str) -> Sequence[RepoModel]
List all repositories for the specified org
Arguments:
org
- Name of the org
get_repo
def get_repo(name: str,
*,
checkout: bool = True,
read_only: bool = False) -> Repo
Get a repo by name
Arguments:
name
- Full name of the repo (of the form [ORG]/[REPO])checkout
- Automatically checkout the repo after instantiation.read_only
- Open the repo in read-only mode.
get_or_create_repo
def get_or_create_repo(name: str,
*,
checkout: bool = True,
bucket_config_nickname: Optional[str] = None) -> Repo
Get a repo by name. Create the repo if it doesn't already exist.
Arguments:
name
- Full name of the repo (of the form [ORG]/[REPO])bucket_config_nickname
- the created repo will use this bucket config for its chunks. If the repo exists, bucket_config_nickname is ignored.checkout
- Automatically checkout the repo after instantiation. If the repo does not exist, checkout is ignored.
create_repo
def create_repo(name: str,
*,
bucket_config_nickname: Optional[str] = None) -> Repo
Create a new repo
Arguments:
name
- Full name of the repo to create (of the form [ORG]/[REPO])bucket_config_nickname
- An optional bucket to use for the chunkstore
delete_repo
def delete_repo(name: str,
*,
imsure: bool = False,
imreallysure: bool = False) -> None
Delete a repo
Arguments:
name
- Full name of the repo to delete (of the form [ORG]/[REPO])
create_bucket_config
def create_bucket_config(*,
org: str,
nickname: str,
uri: str,
extra_config: dict | None = None,
auth_config: dict | None = None) -> BucketResponse
Create a new bucket config entry
NOTE: This does not create any actual buckets in the object store.
Arguments:
org
- Name of the orgnickname
- bucket nickname (example: our-s3-bucket)uri
- The URI of the object store, of the form platform://bucket_name[/prefix].extra_config
- dictionary of additional config to set on bucket configauth_config
- dictionary of auth parameters, must include "method" key, default is{"method": "anonymous"}
set_default_bucket_config
def set_default_bucket_config(*, org: str, nickname: str) -> None
Set the organization's default bucket config for any new repos
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket config to set as default.
get_bucket_config
def get_bucket_config(*, org: str, nickname: str) -> BucketResponse
Get a bucket's configuration
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket config to retrieve.
list_bucket_configs
def list_bucket_configs(org: str) -> list[BucketResponse]
List all buckets for the specified org
Arguments:
org
- Name of the org
list_repos_for_bucket_config
def list_repos_for_bucket_config(*, org: str, nickname: str) -> list[Repo]
List repos using a given bucket config
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket.
delete_bucket_config
def delete_bucket_config(*,
org: str,
nickname: str,
imsure: bool = False,
imreallysure: bool = False) -> None
Delete a bucket config entry
NOTE: If a bucket config is in use by one or more repos, it cannot be deleted. This does not actually delete any buckets in the object store.
Arguments:
org
- Name of the orgnickname
- Nickname of the bucket config to delete. imsure, imreallysure: confirm you intend to delete this bucket config
login
def login(*, org: str | None = None, browser: bool = False) -> None
Login to ArrayLake
Arguments:
org
- Name of the org (only required if your default organization uses SSO)browser
- if True, open the browser to the login page
logout
def logout(*, org: str | None = None, browser: bool = False) -> None
Log out of ArrayLake
Arguments:
org
- Name of the org (only required if your default organization uses SSO)browser
- if True, open the browser to the logout page