Manage table, row, and column-level data permissions in a workspace

Updated at:
Copy as MD

The data permissions feature of Analytics Agent controls the tables, columns, and rows that each account can see when analyzing data in a non-personal workspace. Workspace administrators can configure table permissions and row and column permissions per account to further narrow the data visible to members beyond their existing Data Management (DMS) permissions. This topic describes the permission model, how permissions take effect, and how to configure and maintain data permissions.

Limits

  • Data permissions apply only to non-personal workspaces. Permissions take effect only within the non-personal workspace where they are configured. Workspaces do not inherit permissions from each other, and you cannot configure permissions for all workspaces at once. Configure permissions in each workspace separately. Data permissions are not enabled in personal workspaces and cannot be configured there.

  • Only the OWNER or ADMIN role of a non-personal workspace can configure and view permission rules (read and write access are granted together). The MEMBER role cannot configure permission rules but is still subject to data permissions during analysis. Users who are not members of a workspace cannot use data permissions in that workspace.

  • Alibaba Cloud accounts have no special privileges: permissions for an Alibaba Cloud account can be configured only by the OWNER or ADMIN of the workspace, and the account is rejected if it is not a member of the workspace (error code DMS-DA-40320). Permissions are evaluated per workspace. An administrator of workspace A cannot view or modify the permissions of workspace B.

  • Management permissions are separate from data permissions: administrators can configure data permissions for themselves (including the Alibaba Cloud account itself) and are subject to those rules during analysis. However, the rules do not affect management operations. Even if you restrict yourself through data permissions from viewing any table, you can still modify or delete the rules.

Permission model

Data permissions consist of the following four parts:

Level

Applies to

Granularity

What it controls

Workspace default policy

The entire workspace

One per workspace

Whether databases without table permission records allow or deny all tables by default

Table permissions

Grantee + database

One record per database

Which tables in the database are accessible

Row and column permissions

Grantee + database + table

One record per table

Which columns and rows in the table are visible

Grantee

Account / role

—

Who the preceding rules are granted to

Follow these four principles when you work with the permission model:

  1. Narrow only, never expand: the data that an account can finally access is the intersection of the following two permissions: (1) the table permissions already granted to the account in DMS; (2) the Analytics Agent data permissions. Permissions configured here cannot grant an account access to tables that are not authorized in DMS.

  2. Effective per workspace: permissions take effect only within the non-personal workspace where they are configured. Workspaces do not inherit permissions from each other, and no configuration applies to all workspaces. Data permissions are not enabled in personal workspaces.

  3. Default policy + per-account rules: each workspace has a default policy (allow by default or deny by default) that determines how databases without permission records are handled. Rules configured for an account override the default policy.

  4. Blacklist first: if an object appears in both the whitelist and the blacklist, the blacklist prevails (access denied).

Grantee

The grantee determines who a permission rule is granted to. The following four types are supported:

Type

Format

Example

Coverage

Alibaba Cloud account

Alibaba Cloud account UID

1001

The Alibaba Cloud account only

Regular RAM user

RAM user UID

300748021248884231

That RAM user only

RAM user under a specific role

role ID:RAM user identifier

300748021248884230:alice@example.com

Only that RAM user under the role

Role wildcard

role ID:*

300748021248884230:*

All role-based RAM users under the role (excluding regular RAM users and other roles)

  • Only the complete :* wildcard is supported. Partial wildcards such as alice* are not supported.

  • Pre-configuration is supported: the system does not check whether the grantee is already a member of the workspace or whether the account exists. This suits scenarios where role-based RAM users are assigned on demand by business systems and cannot be registered one by one in advance. Configure role ID:* uniformly first.

  • A grantee can be up to 128 characters long. An optional display name (up to 128 characters) is for page display only and does not participate in permission evaluation.

Workspace default policy

The workspace default policy is part of the workspace configuration. It is maintained outside the data permissions page, and adding or deleting permission rules does not change it. Valid values and their meanings:

Value

Meaning

Allow by default (ALLOW)

If a database has no table permission record for the account, all tables in the database are accessible

Deny by default (DENY)

If a database has no table permission record for the account, no tables in the database are accessible

Not configured / invalid configuration

Treated as deny by default (DENY)

Note

The default policy applies only to databases that have no table permission records at all. If a database has a table permission record, the record prevails, even if its whitelist is empty (which grants nothing in that database).

Table permissions

Table permissions are configured per grantee + database, with one record per database, and control which tables in the database are accessible. Settings:

Setting

Description

Default value

Database

The unique identifier of the database

Required

Table whitelist

Tables allowed for access. ["*"] indicates all tables in the database

[] (grants no tables)

Table blacklist

Tables denied for access. Takes precedence over the whitelist

[]

* can be used only standalone in the whitelist and cannot be mixed with specific table names. The blacklist does not allow *. Common patterns:

  • Allow only some tables: whitelist ["orders", "users"], blacklist [].

  • Allow all tables except sensitive ones: whitelist ["*"], blacklist ["payroll", "salary"].

  • Do not grant access to any table in the database: whitelist [].

Row and column permissions

Row and column permissions are configured per grantee + database + table, with one record per table, and control which columns and rows in the table are visible. Settings:

Setting

Description

Default value

Database and table

The table that the rule applies to

Required

Column whitelist

Visible columns. ["*"] indicates all columns

["*"] (all columns visible)

Column blacklist

Invisible columns. Takes precedence over the whitelist

[]

Row filter condition

A row filter condition that is forcibly appended. Only rows that meet the condition are visible

Empty (no row restriction)

Column list rules are the same as table list rules: * can be used only standalone in the whitelist, and the blacklist does not allow *. An explicitly empty whitelist [] grants no columns.

A row filter condition is a SQL boolean expression (MySQL syntax). Example:

dept_id IN (10, 20) AND status <> 'deleted'

The following items are allowed and prohibited in row filter conditions:

Allowed

Prohibited

Comparisons (=, <>, >, <=, <=>, etc.), IN (...), BETWEEN, LIKE, REGEXP, IS [NOT] NULL, boolean literals, and combinations with AND / OR / XOR / NOT

Subqueries (including EXISTS and IN (SELECT ...)), comments (--, /* */, #), semicolons, implicit truth evaluation (such as a standalone status or 1), and blocking, file, or lock functions such as SLEEP / BENCHMARK / LOAD_FILE / GET_LOCK

  • A row filter condition can be up to 4,000 characters long. It is normalized when saved, so the displayed format may differ from the input (with the same semantics).

  • Literals inside quotes are not subject to the comment or semicolon checks. For example, remark = 'a;b' is valid.

  • If validation fails, error code DMS-DA-40021 is returned.

Input constraints

  • Database names, table names, and column names are case-sensitive and must exactly match the metadata identifiers used by Analytics Agent during analysis. The system does not check whether the databases, tables, or columns actually exist. Select them from the metadata instead of typing them manually.

  • Lists are automatically trimmed of leading and trailing whitespace, deduplicated, and saved in alphabetical order. Empty items are not allowed.

  • Each list supports up to 1,000 items, and each item can be up to 255 characters long. A single request cannot exceed 256 KiB in total.

  • Batch authorization supports up to 100 grantees at a time.

How permissions take effect

When permissions take effect

  • At the start of each analysis, Analytics Agent reads the initiator's permissions in the workspace that the current session belongs to, in real time and under the initiator's own identity. No cache is used.

  • Therefore, rule additions, modifications, and deletions, as well as changes to workspace member roles, take effect at the start of the next analysis. An analysis that has already started runs with the rules read at its start.

  • Analysis uses the permissions of the workspace that the session belongs to and never borrows rules from other workspaces.

Evaluation flow

For each analysis, the system determines the accessible data in the following order:

  1. Find the rules that apply to the initiator

    • Alibaba Cloud accounts / regular RAM users: only rules whose grantee equals the user's own UID apply.

    • Role-based RAM users: both "role ID:*" rules and "role ID:own identifier" rules apply. If both exist for the same database (table permissions) or the same table (row and column permissions), the full-name rule applies as a whole, and no field is inherited from the wildcard rule.

  2. Determine accessible tables database by database (table permissions)

    • The database has a table permission record: accessible tables = whitelist − blacklist (a whitelist of * indicates all tables).

    • The database has no table permission record: the workspace default policy applies. All tables are accessible under ALLOW, and no tables are accessible under DENY.

  3. Determine columns and rows for accessible tables (row and column permissions)

    • The table has no row and column permission record: all columns and rows are visible.

    • The table has a row and column permission record: visible columns = column whitelist − column blacklist. If a row filter condition exists, only rows that meet the condition are visible.

  4. Intersect with DMS permissions

    Analytics Agent finally executes SQL in DMS under the initiator's identity. DMS checks table permissions again, and tables not authorized in DMS remain inaccessible even if they are allowed here.

Rules for determining whether a table is accessible

Default policy

Table permission record for the database

Table in whitelist

Table in blacklist

Result

Any

Yes

Yes (or the whitelist is *)

No

Accessible

Any

Yes

Yes (or the whitelist is *)

Yes

Inaccessible (blacklist prevails)

Any

Yes

No

—

Inaccessible

Any

Yes, with an empty whitelist []

—

—

Inaccessible (the default policy no longer applies)

ALLOW

No

—

—

Accessible

DENY

No

—

—

Inaccessible

Row and column permissions only restrict access; they do not grant table access

  • Table access comes first, then row and column restrictions: row and column permissions alone cannot make a table accessible. If a table is inaccessible, the row and column rules on it do not take effect.

    • For example, if the default policy is DENY and only row and column permissions are configured for orders without table permissions for its database, orders remains inaccessible.

    • If the default policy is ALLOW and the database has no table permission record, orders is accessible, and its columns and rows are restricted by the row and column rules.

  • If a table is accessible but has no row and column permission record, all columns and rows are visible.

  • Deleting table permissions does not delete the row and column permissions on those tables. If a table is allowed again later, the existing row and column restrictions still apply.

How full-name rules interact with wildcard rules for roles

Take role 300 as an example. The following table permissions are configured in the workspace:

Grantee

Database

Table whitelist

Table blacklist

300:*

db_sales

*

payroll

300:alice

db_sales

orders

[]

300:*

db_hr

employees

[]

The table permissions that take effect for the role-based RAM user 300:alice are:

  • db_sales: only orders (the full-name record overrides the wildcard record as a whole; the * whitelist and the payroll blacklist in the wildcard record no longer apply).

  • db_hr: employees (only the wildcard record exists, so it applies directly).

The role-based RAM user 300:bob has no full-name record, so the 300:* rules apply directly to both databases. Row and column permissions work the same way: the full-name record overrides the wildcard record as a whole per database + table, including the row filter condition.

Note

After the 300:alice record for db_sales is deleted, alice falls back to the 300:* rules in that database. If neither exists, the workspace default policy applies.

Typical scenarios

Requirement

Configuration

Deny everything by default in the workspace and allow analysts to access only a few tables in the sales database

Default policy DENY. For the analyst role role ID:*, configure the table whitelist ["orders", "customers"] in the sales database

Allow everything by default and block only the payroll table

Default policy ALLOW. For the relevant accounts, configure the table whitelist ["*"] and blacklist ["payroll"] in the HR database

Hide phone number and ID card columns

Configure row and column permissions for the users table: column whitelist ["*"], column blacklist ["phone", "id_card"]

Regional managers can see only their own region's data

For the orders table, configure the row filter condition region = 'east'

Restrict a role as a whole but relax rules for specific members

Configure strict rules for role ID:* and relaxed rules for role ID:someone (the full-name rule applies as a whole on the same database/table)

Prevent an account from using Analytics Agent to analyze a specific database

Configure an empty table whitelist [] for the account in that database

Configure and maintain data permissions

Prerequisites

  • You are the OWNER or ADMIN of the target non-personal workspace. For information about workspace roles, see the Limits section.

  • To let a member access a table, make sure that the account already has permissions on the table in DMS. Data permissions only narrow access and cannot grant tables that are not authorized in DMS.

Go to the data permissions page

  1. Log on to the Agent console.

  2. In the workspace switcher menu in the upper-left corner, hover over the target non-personal workspace and click the settings (gear) icon to go to the settings page.

  3. Click the Database Permission tab.

The Feature Toggles switch at the top of the Database Permission tab controls whether Data Agent's data visibility and SQL generation are constrained by data permissions.

Administrators can perform the following operations on the data permissions page:

Operation

Purpose

Update method

Add or modify table permissions / row and column permissions

Edit one rule for a grantee on a database or table

Full replacement; version number required

Batch table authorization / batch row and column authorization

Append permissions for up to 100 grantees at a time

Incremental merge; no version number required

Delete table permissions / row and column permissions

Delete one rule (hard delete)

Version number required

Query table permission / row and column permission lists

View stored rules by grantee, page by page

Read-only; exact display; role wildcards are not expanded

Preview permission effects

View the rules that actually take effect for an account (wildcard/full-name records and the default policy already merged)

Read-only

Add or modify a single rule

  1. On the data permissions page, click Add Database Permission (or in the Actions column of the target rule, click Edit), and select the rule type (table permissions or row and column permissions).

  2. Select the grantee, specify the database (and the table for row and column permissions), and configure the whitelist, blacklist, and row filter condition as needed. For the meanings and default values of the settings, see the Permission model section.

  3. Click Save to submit.

Single-rule editing uses full replacement semantics. Note the following write rules:

  • Each save replaces the entire rule with the submitted content. Fields that are not submitted revert to their default values (see the defaults for table permissions and row and column permissions); old values are not retained. For example, submitting only a row filter condition resets the column whitelist to ["*"] and clears the column blacklist. Submit the complete form when editing.

  • Submitting an explicitly empty list [] clears the list. Submitting an empty string for the row filter condition or display name clears the value.

  • Modifying or deleting an existing rule requires the current version number to prevent overwriting others' changes. If the version does not match (error code DMS-DA-40920), refresh and try again. No version number is required when adding a rule.

  • If the submitted content is identical to the existing rule, no change is made and the version number stays the same.

Batch authorization

  1. On the data permissions page, click Batch Authorization and select batch table authorization or batch row and column authorization.

  2. Add grantees (up to 100 at a time), select the database (and the table for batch row and column authorization), and configure the whitelist, blacklist, and row filter condition to append.

  3. Click OK to submit.

Batch authorization appends to existing rules incrementally. All users in the batch share the same database (and the same table for row and column authorization). If any user fails, the entire batch does not take effect. The merge rules for each field are as follows ("not passed" means the field is left empty in this submission):

Field

Merge rule

Whitelist (table/column)

Union with the original whitelist. If either side is *, the result is *. Not passed or [] means nothing is appended

Blacklist not passed

Tables/columns explicitly listed in this whitelist are removed from the original blacklist; the rest of the original blacklist is retained. If this whitelist is *, the original blacklist is not cleared

Blacklist passed as []

Clears the blacklist

Blacklist passed with specific items

Result = (original blacklist − this whitelist) ∪ this blacklist. If this whitelist is *, the original blacklist is cleared first, then this blacklist is written

Row filter condition (row and column authorization only)

Not passed: each user's original condition is retained. A valid condition: full replacement (no AND/OR merge with the original). An empty string: clears the condition

Display name

A non-empty value overwrites the original; otherwise the original is retained

  • The blacklist in this request is always retained. Even if it overlaps with this whitelist, the blacklist prevails.

  • Batch row and column authorization writes only row and column rules and does not grant table permissions at the same time.

  • Batch revocation is not supported. To revoke permissions, use single-rule editing or deletion.

Delete a rule

In the Actions column of the target rule, click Delete, confirm, and submit. Deletion is a hard delete and requires the current version number of the rule. If the version does not match, refresh and try again.

Note

Deleting table permissions does not delete the row and column permissions on those tables. If a table is allowed again later, the existing row and column restrictions still apply.

Query rules and preview permission effects

  • Query the rule list: on the data permissions page, view stored table permissions and row and column permissions by grantee, page by page. The list displays stored rules exactly and does not expand role wildcards.

  • Preview permission effects: click Preview Permission Effects, enter the authorization object (RAM user ID or role), and view the rules that actually take effect for the account (wildcard/full-name records and the default policy already merged). Use this feature first when troubleshooting permission issues.

FAQ

  • Q: I configured permissions for an account, but a table still cannot be queried during analysis. Why?

    A: Check the following items in order: (1) whether DMS has granted the table to the account; (2) whether the session is in the workspace where the permissions are configured; (3) whether the database and table names match the metadata in case; (4) whether the table is excluded by the blacklist; (5) whether a full-name rule for the role-based RAM user overrides the wildcard rule. Use the Preview Permission Effects feature to view the rules that actually take effect for the account.

  • Q: If I delete all rules for an account, can the account see all data?

    A: Not necessarily. Without rules, the workspace default policy applies: all tables are allowed only under ALLOW, and all are denied under DENY. If the default policy is not configured, DENY applies.

  • Q: What happens if only row and column permissions are configured without table permissions?

    A: Row and column permissions do not grant table access. Under DENY, the table is inaccessible. Under ALLOW, if the database has no table permission record, the table is accessible and subject to the row and column rules.

  • Q: If a member is removed from a workspace or the workspace is deleted, are the permission rules deleted?

    A: No. Rules and membership are independent. However, non-members cannot analyze in the workspace, so the rules are not used. After the member rejoins, the existing rules take effect again.

  • Q: Do the permissions configured by an administrator also restrict the administrator?

    A: Yes. Administrators (including the Alibaba Cloud account) are subject to the applicable rules during analysis. However, the rules do not affect management operations: administrators can always modify or delete rules.

  • Q: How long does it take for a change to take effect?

    A: At the start of the next analysis. There is no cache delay.

  • Q: Can I configure permissions for all workspaces at once?

    A: No. Permissions take effect only within a single non-personal workspace. Configure them in each workspace separately.

Common error codes

Error code

Meaning

Suggested action

DMS-DA-40020

Invalid rule: incorrect grantee format, empty items in a list, * not used standalone in the whitelist, * in the blacklist, etc.

Fix the rule according to the input requirements in the Permission model section and resubmit

DMS-DA-40021

Invalid row filter condition

Fix the condition according to the row filter rules in the Row and column permissions section

DMS.DataAgent.ParamInvalid

Field too long, list exceeds 1,000 items, request body exceeds 256 KiB, etc.

Reduce the content per submission or submit in batches

DMS-DA-40320

No management permission: not the OWNER/ADMIN of the workspace, personal workspace, or the workspace does not exist or does not belong to the current account/region

Verify the workspace and your role

DMS-DA-40321

The analysis initiator is not a member of the non-personal workspace, so data permissions cannot be read

Add the account to the workspace

DMS-DA-40023 / 40022

Version number missing, zero, or negative when modifying or deleting an existing rule

Query the current version number first

DMS-DA-40920

The rule has been modified by someone else; version mismatch

Refresh and edit again

DMS-DA-40420

The rule does not exist (possibly deleted), but the request carries a version number

Refresh and treat it as a new rule

DMS-DA-40921

Another request is modifying the same rule concurrently

Try again later