Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions sdk/python-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ The Lightdash Python SDK lets you query your semantic layer directly from Python
pip install lightdash
```

## Before you start

To use the SDK, you need three things from your Lightdash instance:

1. **`instance_url`** — the URL where you log into Lightdash (for example, `https://app.lightdash.cloud` for Lightdash Cloud, or your self-hosted URL like `https://lightdash.mycompany.com`).
2. **`project_uuid`** — the unique ID of the project you want to query.
3. **`access_token`** — a personal access token (PAT) used to authenticate as you.

You don't need to be an admin to do any of this. You just need access to the project you want to query.

### How to get your project UUID

1. Log in to Lightdash and open the project you want to query.
2. Look at the URL in your browser's address bar. It looks like this:

```
https://app.lightdash.cloud/projects/3675b69e-8324-4110-bdca-059031aa8da3/home
```
3. Copy the long string between `/projects/` and the next `/`. In the example above, the project UUID is `3675b69e-8324-4110-bdca-059031aa8da3`.

### How to get a personal access token

1. Click your avatar (top-right corner) and go to **Settings**.
2. In the left-hand menu, under your name, click **Personal access tokens**.
3. Click **Generate new token**.
4. Give it a description (for example, "Python SDK") and pick an expiration date.
5. Click **Generate token**.
6. **Copy the token immediately and save it somewhere safe** — you won't be able to see it again after closing the dialog. If you lose it, just generate a new one.

<Tip>
Treat your access token like a password. Don't commit it to git or share it. For scripts, load it from an environment variable (for example, `os.environ["LIGHTDASH_TOKEN"]`) instead of pasting it directly into your code.
</Tip>

For more details, see [Personal access tokens](/references/workspace/personal-tokens).

## Quick start

```python
Expand Down
Loading