CREATE JOIN POLICY

statementsupportedGovernance (policies, tags, data quality)Enterprise+preview

docs.snowflake.com ↗

Object: JOIN POLICY

Creates a new join policy in the current/specified schema or replaces an existing join policy. After creating a join policy, assign the policy to a table using an ALTER TABLE command or a view using an ALTER VIEW command. Alternatively, you can assign a join policy to a table when you create it.

Syntax

supportedpartialnot supportednot scored

CREATE [ OR REPLACE ] JOIN POLICY [ IF NOT EXISTS ] <name>
  AS () RETURNS JOIN_CONSTRAINT -> <body>
  [ COMMENT = '<string_literal>' ]

Parameters

NameRequiredDescription
nameIdentifier for the join policy; must be unique for your schema. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements.
AS () RETURNS JOIN_CONSTRAINTSignature and return type of the policy. The signature does not accept any arguments, and the return type is JOIN_CONSTRAINT, which is an internal data type. All join policies have the same signature and return type.
JOIN_REQUIRED => boolean_expressionSpecifies whether a join is required in queries when data is selected from tables or views that have the join policy assigned to them.
COMMENT = 'string_literal'Adds a comment or overwrites an existing comment for the join policy.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE JOIN POLICY | Schema | Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control. For more information about join policy DDL and privileges, see Managing join policies.

See also