mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 07:12:27 +00:00
Move the public website pages into `docs/web` beside the SDK, with
shared navigation and executable example sources in `docs/web-tests`.
The combined website is assembled by
[lancedb/docs#355](https://github.com/lancedb/docs/pull/355), with six
Enterprise replacements from
[lancedb/sophon#7681](https://github.com/lancedb/sophon/pull/7681).
This includes Function guidance, runnable Quickstarts, regenerated
snippets, production contact/demo fixes, the legacy SQL route, and the
LeRobot redirect. LeRobot remains attributed to Geneva; all 34 Geneva
pages remain in the docs repository until Function officially launches.
Materialized-view guidance follows the full rebuild refresh introduced
by #4373: local refresh writes the complete result, has no `full`
argument, supports `source_version`, and no longer requires stable row
IDs. Deployment SQL refresh options and stable-ID setup are qualified by
version/configuration. Function input guidance distinguishes ordinary
stored columns from computed inputs supported by newer deployments.
**Validation:** independently accepted local checks include 95 Python
tests (real Enterprise excluded), eight TypeScript tests, Rust
Quickstart, snippet parity, typos, deterministic assembly, Mint
validation and links/anchors/redirects. The combined baseline retains
all 181 production routes and 17 legacy redirects. Examples ran locally
against source-built Python SDK 0.40.0b13; existing GitHub workflows do
not run `docs/web-tests`. New main at `069b2f7d` is 0.41.0b0 and adds
computed Function inputs; that SDK was not exercised by the accepted
tests. Latest prose corrections receive focused site validation.
**Merge/rollout:** merge this and #7681 before #355's combined CI, which
reads producer `main`. This is migration infrastructure: section
overlays, source-owned skills and automatic versioned paired releases
remain follow-ups. The current manual publisher is transitional. Hosted
validation, a supported SDK/Enterprise release pair and a real
Enterprise walkthrough remain pending.
Production Mintlify watches `lancedb/docs:deploy-freeze`, directory
`docs`; preserve that source through review. The separate SDK GitHub
Pages reference workflow rebuilds on main merges.
**Updated-head CI (9a50f8db):**
[Typos](https://github.com/lancedb/lancedb/actions/runs/37654185443/job/112904990558),
[PR
title](https://github.com/lancedb/lancedb/actions/runs/37654179507/job/112904974595)
and
[Aikido](https://app.aikido.dev/featurebranch/scan/215386145?groupId=74229)
pass. Critical findings in the example lockfiles were patched: all Sharp
copies use 0.35.5, protobufjs 7.6.6, tar 7.5.22, quinn-proto 0.11.19,
zerovec 0.11.8 and zerovec-derive 0.11.6. The SDK's product dependencies
are unchanged. The revised lockfiles pass eight TypeScript examples,
HuggingFace decode/resize/crop/rescale/normalize plus AVIF roundtrip,
and Rust Quickstart. Aikido passing does not mean every advisory is
cleared; npm still reports 29 high and five moderate advisories in the
example dependency graph. No scanner bypass or suppression was added.
The Function prose correction passes combined/standalone Mint,
deterministic assembly, routes and assets. The revised 325-file site
checksum is
`175bec06864abb400dd292e667ba93448c0479b8359fd7bf6146afabf9040647`. This
PR remains open for independent review; further merges are on hold.
---------
Co-authored-by: Brendan Clement <brendan.clement@lancedb.com>
171 lines
6.9 KiB
Plaintext
171 lines
6.9 KiB
Plaintext
---
|
|
title: "Authentication"
|
|
sidebarTitle: "Authentication"
|
|
description: "Authentication modes for LanceDB Enterprise: API keys and OAuth credentials."
|
|
icon: key
|
|
keywords: ["authentication", "oauth", "api key", "azure managed identity", "client credentials"]
|
|
---
|
|
|
|
<Badge color="red">Enterprise</Badge>
|
|
|
|
This page describes a LanceDB Enterprise capability. The embedded form
|
|
of LanceDB has no server to provide it -- see
|
|
[Architecture](/architecture) for what differs between the two.
|
|
|
|
A deployment authenticates every request before
|
|
[authorization](/governance/authorization) decides what it may do, against a
|
|
`db://` remote table, in one of two ways:
|
|
|
|
- **API keys** -- a long-lived shared secret passed as `api_key` on connect. Works in every SDK.
|
|
- **OAuth 2.0** -- short-lived bearer tokens obtained from your identity provider, refreshed automatically by the client.
|
|
|
|
OAuth is the recommended option when you want to rotate credentials centrally,
|
|
plug into an existing identity provider, or run on Azure with managed
|
|
identities so no secret material lives on the client.
|
|
|
|
## API key {#api-key}
|
|
|
|
Pass the API key from your Enterprise tenant on `connect`. This works with
|
|
both the synchronous and asynchronous Python clients, as well as TypeScript
|
|
and Rust.
|
|
|
|
```python
|
|
import lancedb
|
|
|
|
db = lancedb.connect(
|
|
uri="db://your-database-uri",
|
|
api_key="your-api-key",
|
|
region="us-east-1",
|
|
host_override="https://your-enterprise-endpoint.com",
|
|
)
|
|
```
|
|
|
|
An API key belongs in the environment rather than in source. See
|
|
[Database](/management/database#deployment) for the connection options.
|
|
|
|
## OAuth {#oauth}
|
|
|
|
The async Python client and the TypeScript client can obtain bearer tokens
|
|
from an OIDC issuer and attach them to every request. Token acquisition,
|
|
caching, and refresh are handled inside the client -- your application code
|
|
only provides the configuration.
|
|
|
|
<Info>
|
|
In Python, OAuth is supported through `lancedb.connect_async`. The synchronous
|
|
`connect` entry point continues to use API key authentication for `db://`
|
|
URIs. In TypeScript, `lancedb.connect` accepts `oauthConfig` directly.
|
|
</Info>
|
|
|
|
### Supported flows {#supported-flows}
|
|
|
|
`OAuthFlowType` selects how the client acquires tokens:
|
|
|
|
| Flow | Python value | TypeScript value | When to use |
|
|
| --- | --- | --- | --- |
|
|
| Client Credentials | `OAuthFlowType.CLIENT_CREDENTIALS` | `OAuthFlowType.ClientCredentials` | Service-to-service / machine-to-machine. Requires a client ID and client secret registered with your identity provider. |
|
|
| Azure Managed Identity | `OAuthFlowType.AZURE_MANAGED_IDENTITY` | `OAuthFlowType.AzureManagedIdentity` | Workloads running on Azure compute (VMs, AKS, App Service, Container Apps). Tokens are fetched from the Azure IMDS endpoint, so no client secret is stored on the client. |
|
|
|
|
### Configure OAuth {#configure-oauth}
|
|
|
|
Build an OAuth config and pass it on connect. Use `oauth_config` in Python and
|
|
`oauthConfig` in TypeScript.
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
import lancedb
|
|
from lancedb.remote import OAuthConfig, OAuthFlowType
|
|
|
|
# Client Credentials (service-to-service)
|
|
oauth_config = OAuthConfig(
|
|
issuer_url="https://login.microsoftonline.com/{tenant}/v2.0",
|
|
client_id="your-application-client-id",
|
|
client_secret="your-application-client-secret",
|
|
scopes=["api://lancedb-api/.default"],
|
|
flow=OAuthFlowType.CLIENT_CREDENTIALS,
|
|
)
|
|
|
|
db = await lancedb.connect_async(
|
|
uri="db://your-database-uri",
|
|
region="us-east-1",
|
|
host_override="https://your-enterprise-endpoint.com",
|
|
oauth_config=oauth_config,
|
|
)
|
|
```
|
|
|
|
```typescript TypeScript icon="square-js"
|
|
import * as lancedb from "@lancedb/lancedb";
|
|
import { OAuthConfig, OAuthFlowType } from "@lancedb/lancedb";
|
|
|
|
// Client Credentials (service-to-service)
|
|
const oauthConfig: OAuthConfig = {
|
|
issuerUrl: "https://login.microsoftonline.com/{tenant}/v2.0",
|
|
clientId: "your-application-client-id",
|
|
clientSecret: "your-application-client-secret",
|
|
scopes: ["api://lancedb-api/.default"],
|
|
flow: OAuthFlowType.ClientCredentials,
|
|
};
|
|
|
|
const db = await lancedb.connect("db://your-database-uri", {
|
|
region: "us-east-1",
|
|
hostOverride: "https://your-enterprise-endpoint.com",
|
|
oauthConfig,
|
|
});
|
|
```
|
|
</CodeGroup>
|
|
|
|
For workloads running on Azure compute, use a managed identity instead of a
|
|
client secret:
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
from lancedb.remote import OAuthConfig, OAuthFlowType
|
|
|
|
oauth_config = OAuthConfig(
|
|
issuer_url="https://login.microsoftonline.com/{tenant}/v2.0",
|
|
client_id="your-application-client-id",
|
|
scopes=["api://lancedb-api/.default"],
|
|
flow=OAuthFlowType.AZURE_MANAGED_IDENTITY,
|
|
# Optional: required only for user-assigned managed identities.
|
|
managed_identity_client_id="your-user-assigned-identity-client-id",
|
|
)
|
|
```
|
|
|
|
```typescript TypeScript icon="square-js"
|
|
import { OAuthConfig, OAuthFlowType } from "@lancedb/lancedb";
|
|
|
|
const oauthConfig: OAuthConfig = {
|
|
issuerUrl: "https://login.microsoftonline.com/{tenant}/v2.0",
|
|
clientId: "your-application-client-id",
|
|
scopes: ["api://lancedb-api/.default"],
|
|
flow: OAuthFlowType.AzureManagedIdentity,
|
|
// Optional: required only for user-assigned managed identities.
|
|
managedIdentityClientId: "your-user-assigned-identity-client-id",
|
|
};
|
|
```
|
|
</CodeGroup>
|
|
|
|
### Configuration reference {#configuration-reference}
|
|
|
|
The same configuration is available in both SDKs. Python uses `snake_case`
|
|
field names; TypeScript uses `camelCase`.
|
|
|
|
| Python field / TypeScript field | Required | Description |
|
|
| --- | --- | --- |
|
|
| `issuer_url` / `issuerUrl` | Yes | OIDC issuer URL or OAuth authority URL. For Azure, use `https://login.microsoftonline.com/{tenant_id}/v2.0`. |
|
|
| `client_id` / `clientId` | Yes | Application / client ID registered with your identity provider. |
|
|
| `scopes` | Yes | List of OAuth scopes to request. For Azure managed identity, provide exactly one scope or resource, for example `["api://your-app-id/.default"]`. |
|
|
| `flow` | No | Selects the OAuth flow. Defaults to Client Credentials. |
|
|
| `client_secret` / `clientSecret` | Conditional | Required for Client Credentials. Redacted from the config's `repr` (Python) and `Debug` output (TypeScript native binding) so it does not leak into logs. |
|
|
| `managed_identity_client_id` / `managedIdentityClientId` | No | Client ID of a user-assigned managed identity. Only used with Azure Managed Identity; omit for system-assigned identities. |
|
|
| `refresh_buffer_secs` / `refreshBufferSecs` | No | How many seconds before token expiry to proactively refresh. Defaults to 300. Keep this well below the token TTL -- setting it greater than or equal to the TTL forces a refresh on every request. |
|
|
|
|
<Warning>
|
|
Treat the client secret like any other production credential. Load it from a
|
|
secret manager or environment variable rather than committing it to source
|
|
control. Both SDKs deliberately omit the secret from their debug/repr output
|
|
so accidental log lines do not expose the value.
|
|
</Warning>
|
|
|
|
Embedded LanceDB has nothing to authenticate to -- your process opens the files
|
|
directly, and the object store's own credentials are the only gate.
|