lakefs.client module

lakeFS Client module

Handles authentication against the lakeFS server and wraps the underlying lakefs_sdk client.

class lakefs.client.Client(**kwargs)[source]

Bases: object

Wrapper around lakefs_sdk’s client object Takes care of instantiating it from the environment

Example of initializing a Client object:

from lakefs import Client

client = Client(username="<access_key_id>", password="<secret_access_key>", host="<lakefs_endpoint>")
print(client.version)
property config

Return the underlying lakefs_sdk configuration

property sdk_client

Return the underlying lakefs_sdk client

property storage_config

lakeFS SDK storage config object, lazy evaluated.

property version: str

lakeFS Server version, lazy evaluated.

class lakefs.client.ServerConfiguration(client=None)[source]

Bases: object

Represent a lakeFS server’s configuration

property storage_config: ServerStorageConfiguration

Returns the lakeFS server storage configuration

property version: str

Return the lakeFS server version

lakefs.client.from_aws_role(session, ttl_seconds=3600, presigned_ttl=60, additional_headers=None, **kwargs)[source]

Create a lakeFS client from an AWS role. :type session: Session :param session: : The boto3 session. :type ttl_seconds: int :param ttl_seconds: The time-to-live for the generated lakeFS token in seconds. The default value is 3600 seconds. :type presigned_ttl: int :param presigned_ttl: The time-to-live for the presigned URL in seconds. The default value is 60 seconds. :type additional_headers: Optional[dict[str, str]] :param additional_headers: Additional headers to include in the presigned URL. :type kwargs: :param kwargs: The arguments to pass to the client. :rtype: Client :return: A lakeFS client.

lakefs.client.from_web_identity(code, state, redirect_uri, ttl_seconds=3600, **kwargs)[source]

Authenticate against lakeFS using a code received from an identity provider

Parameters:
  • code (str) – The code received from the identity provider

  • state (str) – The state received from the identity provider

  • redirect_uri (str) – The redirect URI used in the authentication process

  • ttl_seconds (int) – The token’s time-to-live in seconds

  • kwargs – Remaining arguments for the Client object

Return type:

Client

Returns:

The authenticated Client object

Raises:

NotAuthorizedException – if user is not authorized to perform this operation