Skip to content

Getting Started with High-Level SDK

The High-Level SDK provides a Pythonic interface to lakeFS. This page covers installation, initialization, and configuration of the SDK.

Installation

Install the High-Level SDK using pip:

pip install lakefs

Or upgrade to the latest version:

pip install --upgrade lakefs

Initialization

The High-Level SDK by default will try to collect authentication parameters from the environment and attempt to create a default client. When working in an environment where lakectl is configured, it is not necessary to instantiate a lakeFS client or provide it for creating the lakeFS objects.

In case no authentication parameters exist, it is also possible to explicitly create a lakeFS client.

Basic Client Initialization

Here's how to instantiate a client:

from lakefs.client import Client

clt = Client(
    host="http://localhost:8000",
    username="AKIAIOSFODNN7EXAMPLE",
    password="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
)

Info

See here for instructions on how to log in with Python using your AWS role. This is applicable for enterprise users.

SSL Configuration

You can use TLS with a CA that is not trusted on the host by configuring the client with a CA cert bundle file. It should contain concatenated CA certificates in PEM format:

clt = Client(
    host="https://lakefs.example.io",
    username="AKIAIOSFODNN7EXAMPLE",
    password="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    # Customize the CA certificates used to verify the peer.
    ssl_ca_cert="path/to/concatenated_CA_certificates.PEM",
)

For connecting to a secure endpoint without verification (for test environments):

clt = Client(
    host="https://lakefs.example.io",
    username="AKIAIOSFODNN7EXAMPLE",
    password="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    verify_ssl=False,
)

Warning

This setting allows well-known "man-in-the-middle", impersonation, and credential stealing attacks. Never use this in any production setting.

Proxy Configuration

To enable communication via proxies, add a proxy configuration:

clt = Client(
    host="https://lakefs.example.io",
    username="AKIAIOSFODNN7EXAMPLE",
    password="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    ssl_ca_cert="(if needed)",
    proxy="<proxy server URL>",
)

Next Steps

Once you have initialized the SDK, explore the different operations: