Permissions define which catalogs, schemas, and tables a technical user can access. They act as an application-level allow list on top of Trino's built-in authorization — primarily useful for service accounts that execute queries via a shared system user.
Permission interface #
| Property | Type | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ||||||||||||||||||||||||||||||
Username to match against | |||||||||||||||||||||||||||||||
| useSystemUser | boolean | ||||||||||||||||||||||||||||||
Whether this user’s queries run via the Trino system user. | |||||||||||||||||||||||||||||||
| permissions | Object | ||||||||||||||||||||||||||||||
Read and write access rules. | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Wildcard access #
Use ["*"] in the tables array to grant access to all tables within a catalog/schema combination:
1
2
3
4
5
6
{
catalog: "hive",
schema: "analytics",
tables: ["*"] // access all tables in hive.analytics
}
createPermission helper #
For type-safe permission construction that validates against your generated configs, use the createPermission helper with defineConfig:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28import { createPermission as createPermissionFromApi } from "@lakeql/api/helpers"
import type { Permission } from "@lakeql/api/types"
import { allConfigs } from "./config-registry"
const createPermission = createPermissionFromApi(allConfigs)
export const permissions: Permission[] = [
{
name: "data-pipeline-service",
useSystemUser: true,
permissions: {
Query: [
createPermission("hive", "raw_data", ["events", "users", "sessions"]),
],
Mutation: [createPermission("hive", "processed", ["aggregated_events"])],
},
},
{
name: "reporting-service",
useSystemUser: true,
permissions: {
Query: [createPermission("hive", "analytics", ["*"])],
Mutation: [],
},
},
]
How permissions are evaluated #
- Read (Query): If no permission entry exists for a user, reads are allowed (Trino handles auth for human users). If rules exist, at least one must match the requested catalog/schema/table.
- Write (Mutation): If no permission entry exists, writes are denied. Rules must explicitly grant access.
See Scope Authorization for the full evaluation logic.