Troubleshoot dynamic table permission issues¶
This page helps you diagnose and resolve permission-related dynamic table failures. For refresh failures unrelated to permissions, see Troubleshoot dynamic table refresh issues. For creation-time issues, see Troubleshoot dynamic table creation issues.
Refresh fails because secondary roles are not used¶
A query that succeeds interactively can fail during refresh because refreshes use only the owner role: secondary roles are not activated.
Typical error messages:
-
Identify which objects the refresh can’t access. Check the refresh history for the error details:
-
Grant the missing privileges directly to the dynamic table’s owner role:
-
If the privileges come from a database role, grant that database role to the dynamic table’s owner role.
Important
Do not rely on secondary roles for dynamic table access. Every object referenced in the definition must be accessible through the owner role’s primary grants.
Refresh fails after ownership transfer¶
When you transfer ownership of a dynamic table to a different role (using GRANT OWNERSHIP),
the new owner role might not have all the privileges that the original owner had. Refreshes
start failing because the new role can’t access the warehouse, base tables, or functions.
-
Check which role now owns the dynamic table:
-
Grant the new owner role all privileges needed to refresh the dynamic table:
-
After granting the privileges, resume the dynamic table if it was auto-suspended due to consecutive failures:
Tip
Before transferring ownership, run SHOW GRANTS TO ROLE <current_owner> to capture the
full list of grants. Replicate those grants to the new owner role before the transfer.
Row access policies or masking policies block incremental refresh¶
Row access and masking policies on base tables can block incremental refresh if they call context functions like CURRENT_ROLE or IS_ROLE_IN_SESSION. These functions require a full session context that incremental refresh does not provide.
Typical error messages:
-
Identify which base tables have row access or masking policies:
-
Resolution options:
Option A: Switch to FULL refresh mode. Full refresh evaluates the entire query from scratch on each refresh, so context functions in policies work correctly:
Option B: Apply the policy on the dynamic table instead. Remove the policy from the base table and apply it to the dynamic table. Since the policy runs at query time (not refresh time), context functions work correctly:
IS_ ROLE_ IN_ SESSION() only accepts constant arguments in incremental mode¶
When a dynamic table uses incremental refresh and the definition references a base table with a
row access policy that calls IS_ROLE_IN_SESSION(), the policy function must use only constant
string arguments. Variable or column-based arguments are not supported in incremental mode.
-
Check the row access policy definition to see how
IS_ROLE_IN_SESSION()is called: -
If the policy uses a column reference as the argument (for example,
IS_ROLE_IN_SESSION(allowed_role)), this is not supported in incremental mode. -
Resolution options:
- Rewrite the policy to use constant role names:
IS_ROLE_IN_SESSION('ANALYST_ROLE'). - Move the policy from the base table to the dynamic table, where it runs at query time rather than refresh time.
- Switch the dynamic table to
REFRESH_MODE = FULL.
- Rewrite the policy to use constant role names:
Projection policies cause unexpected refresh behavior¶
Projection policies on base table columns can affect dynamic table refresh behavior. If a projection policy restricts a column the definition references, the refresh either sees masked data (producing incorrect output) or fails outright if the owner role is not in the policy’s allowed list.
-
Check if any base tables have projection policies:
-
If the dynamic table’s owner role is not in the projection policy’s allowed list, the refresh sees masked or restricted data. Grant the owner role the appropriate access or modify the projection policy:
-
If you want the dynamic table to contain the unmasked data (for downstream consumption with separate access controls), ensure the owner role has full access through the projection policy.
Can’t see dynamic table metadata¶
If SHOW DYNAMIC TABLES or INFORMATION_SCHEMA.DYNAMIC_TABLES() returns no rows for a dynamic
table you know exists, the issue is a missing privilege.
-
Verify that the dynamic table exists and your role can see it:
If this returns no rows, your role may also need USAGE on the database and schema.
-
Check whether your role has the MONITOR privilege on the dynamic table:
-
If your role doesn’t have MONITOR, ask the dynamic table owner to grant it:
For the full list of privileges required for dynamic table operations, see Dynamic table access control.
Refresh fails with EXECUTE AS USER permission errors¶
When a dynamic table uses EXECUTE AS USER, refreshes can fail if the required privileges or
user configuration are missing.
Missing IMPERSONATE privilege. The dynamic table’s owner role must hold IMPERSONATE on the target user. If this privilege is missing or was revoked, refreshes fail with a permission error. Grant IMPERSONATE on the target user to the dynamic table’s owner role:
User does not exist. The user specified in EXECUTE AS USER must exist. If the user was dropped or never created, refreshes fail. Recreate the user and ensure it holds the dynamic table’s owner role:
After resolving the issue, resume the dynamic table if it was auto-suspended:
What’s next¶
- To troubleshoot refresh failures on an existing dynamic table, see Troubleshoot dynamic table refresh issues.
- To troubleshoot creation-time issues, see Troubleshoot dynamic table creation issues.
- For the complete privilege reference, see Dynamic table access control.
- To set up monitoring and alerts, see Monitor dynamic tables.