Files
lancedb/docs/web/governance/principals.mdx
T
Brendan ClementandClaude e2501b0dab docs: update example names (#4887)
Use neutral placeholder names and values in a few code examples in the
docs and Python docstrings. Text-only; no behavior change.

---
_Generated by [Claude
Code](https://claude.ai/code/session_019iqZdtD3ZMnvTMeoNsULgX)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-06 11:32:48 -08:00

78 lines
2.6 KiB
Plaintext

---
title: "Principals"
sidebarTitle: "Principals"
description: "Users, groups, and roles: where each comes from, and how a GRANT or REVOKE statement names one."
icon: user
keywords: ["principal", "role", "group", "user", "subject", "rbac"]
availability:
embedded: unavailable
enterprise: available
---
A grant names one of three kinds of subject:
| Subject | Where it comes from |
| --- | --- |
| User (principal) | Your identity provider -- OIDC, Microsoft Entra, Okta, or Keycloak. LanceDB never creates one. |
| Group | Also your identity provider. LanceDB never creates one. |
| Role | LanceDB itself. There is no statement that creates a role -- naming one in a grant is what brings it into existence. |
## Naming a subject in SQL {#naming}
`GRANT` and `REVOKE` accept a role, user, or group name directly, with an
optional keyword to disambiguate:
<CodeGroup>
```sql SQL icon="database"
GRANT USAGE ON SECRET platform.`model-api-key` TO ROLE research
GRANT USAGE ON SECRET platform.`model-api-key` TO USER alice
GRANT USAGE ON SECRET platform.`model-api-key` TO GROUP `data-science`
```
</CodeGroup>
A `USER` or `GROUP` name is resolved against your identity provider, but
only after the caller's `OWNERSHIP` on the object is checked. A name that
isn't found, or that matches more than one identity, is an error -- not a
silent no-op. `ROLE` needs no such lookup, since a role is simply whatever
name a grant has used.
Name several subjects of the same kind in one statement by omitting the
keyword after the first:
<CodeGroup>
```sql SQL icon="database"
GRANT USAGE ON SECRET platform.`model-api-key` TO ROLE etl, rotation_service
```
</CodeGroup>
## Role membership in SQL {#membership}
SQL manages which users or groups a role applies to -- its membership --
directly:
<CodeGroup>
```sql SQL icon="database"
GRANT ROLE analysts TO USER alice
GRANT ROLE analysts TO GROUP `data-science`
REVOKE ROLE analysts FROM USER alice
SHOW ROLE BINDINGS
```
</CodeGroup>
Changing membership (`GRANT`/`REVOKE ROLE`) needs system `OPERATE`;
`SHOW ROLE BINDINGS` needs only system `USAGE`. A role binding accepts a
`USER` or `GROUP` on the receiving side, never another `ROLE` -- granting
a privilege to a role before anyone is a member of it is still valid; the
role simply has no effect until it has members.
## What to read next {#next}
<CardGroup cols={2}>
<Card title="Authorization" icon="shield-halved" href="/governance/authorization">
The access-control model a grant is built from.
</Card>
<Card title="Privileges" icon="key" href="/governance/privileges">
Every object's privileges, and the GRANT/REVOKE syntax that covers them.
</Card>
</CardGroup>