Get started with TileDB Client for Python

This is a starting guide for the TileDB-Client-Py client.

Authentication

To authenticate with TileDB, you first need to configure your credentials. You will need one of the following:

  • A REST API token generated for your account (recommended).
  • Your username and password, along with the name of the workspace to which you want to connect (not recommended).

You only need to configure your credentials once. Once your credentials are configured, TileDB will fetch them and use them for logging in, so that you don’t need to re-enter your credentials.

Configure credentials

Token method

import tiledb.client

# First configure your credentials (saves to default profile)
tiledb.client.configure(
    host=<host>,
    token=<token>
)

Username and password method

import tiledb.client

# First configure your credentials (saves to default profile)
tiledb.client.configure(
    host=<host>,
    username=<username>,
    password=<password>,
    workspace=<workspace>
)

Log in to TileDB

After you configured your credentials, you can log in by running the following:

tiledb.client.login()

And that’s it. No additional pieces of information are required.

Profiles

If you’re working with multiple TileDB deployments, you can configure a different profile for each credential you want to use when authenticating to TileDB. When you run tiledb.client.configure(), include the profile_name argument with a string that you want to use for your profile:

tiledb.client.configure(
    host=<host>,
    token=<token>,
    profile_name=<profile_name>,
)

Then, when you want to log in with that profile, run the following:

tiledb.client.login(profile_name=<profile_name>)

If you don’t provide a profile name during configuration or login, TileDB creates a profile name called "default" in the backend to store the credentials.