> For the complete documentation index, see [llms.txt](https://docs.snowddl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snowddl.com/basic/yaml-configs/projection-policy.md).

# PROJECTION POLICY

Config path: `/<database>/<schema>/projection_policy/<name>.yaml`

Example:

```yaml
body: |-
  CASE WHEN IS_ROLE_IN_SESSION('SYSADMIN') THEN PROJECTION_CONSTRAINT(ALLOW => true)
       ELSE PROJECTION_CONSTRAINT(ALLOW => true)
  END

references:
  - object_type: TABLE
    object_name: test_table_1
    column: id

  - object_type: VIEW
    object_name: test_view_1
    column: id

comment: my projection policy
```

## Schema

* <mark style="background-color:red;">**body**</mark> (str) - policy SQL expression
* ~~**references**~~ (dict)
  * **object\_type** (str) - reference object type (e.g. `TABLE`, `VIEW`)
  * **object\_name** (ident) - reference object name
  * **column** (ident) - reference column name
* **comment** (str)&#x20;

## Usage notes

1. Management of projection policies requires active warehouse due to unavoidable [POLICY\_REFERENCES](https://docs.snowflake.com/en/sql-reference/functions/policy_references.html) table function calls.
2. Make sure to allow projections for role `SYSADMIN`, especially if projection policy is being applied to views. Otherwise SnowDDL will have to re-create VIEW on every run due to inability to verify column data types.\
   \
   Example of check: `CASE WHEN IS_ROLE_IN_SESSION('SYSADMIN') THEN PROJECTION_CONSTRAINT(ALLOW => true) ELSE ... END`
3. Parameter `references` is deprecated since `0.33.0`. Use policy reference parameters directly in [TABLE](/basic/yaml-configs/table.md) or [VIEW](/basic/yaml-configs/view.md) configs instead.

## Links

* [CREATE PROJECTION POLICY](https://docs.snowflake.com/en/sql-reference/sql/create-projection-policy)
* [SHOW PROJECTION POLICIES](https://docs.snowflake.com/en/sql-reference/sql/show-projection-policies)
* [DESC PROJECTION POLICY](https://docs.snowflake.com/en/sql-reference/sql/desc-projection-policy)
* [Parser & JSON Schema (GitHub)](https://github.com/littleK0i/SnowDDL/blob/master/snowddl/parser/projection_policy.py)
