ALTER QUERY POLICY

View as Markdown
PREVIEW This feature is in private preview. It is under active development and may have stability or performance issues. It isn't subject to our backwards compatibility guarantees.
To enable this feature for your environment, contact our team.

ALTER QUERY POLICY changes the mode, rules, or owner of a query policy. Changes apply to queries admitted after the change, on every cluster the policy is attached to. Queries that are already running are not affected.

Syntax

ALTER QUERY POLICY <name> SET (
  [MODE = '<mode>']
  [, RULES (
    <rule_name> (action = 'reject', metric = 'query_plan_includes', value = '<plan_feature>')
    [, ...]
  )]
)
;
Syntax element Description
<name> The name of the query policy to modify.
MODE Optional. 'warn' or 'enforce'. See CREATE QUERY POLICY.
RULES Optional. The new set of rules. Replaces all existing rules in the policy. Specify RULES () to remove all rules.
<rule_name> The name for the rule. Must be unique within the query policy.
<plan_feature> 'temporary_dataflow' or 'storage_read'. See CREATE QUERY POLICY.
ALTER QUERY POLICY <name> OWNER TO <new_owner_role>;
Syntax element Description
<name> The name of the query policy.
<new_owner_role> The role to own the query policy.

Privileges

The privileges required to execute this statement are:

  • Ownership of the query policy.

To change the owner, you must also be a member of the new owner role.

Examples

Switch a policy from warn to enforce:

ALTER QUERY POLICY indexed_reads_only SET (MODE = 'enforce');

Replace a policy’s rules:

ALTER QUERY POLICY indexed_reads_only SET (
  RULES (
    no_storage_reads (action = 'reject', metric = 'query_plan_includes', value = 'storage_read')
  )
);
Back to top ↑