# ROW ACCESS POLICY

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

Example:

```yaml
arguments:
  status: VARCHAR(255)

body: |-
  status = 'Active'

references:
  - object_type: TABLE
    object_name: test_table_2
    columns: [status]
```

## Schema

* <mark style="background-color:red;">**arguments**</mark> (dict)
  * *{key}* (ident) - argument name
  * *{value}* (str) - argument data type
* <mark style="background-color:red;">**body**</mark> (str) - policy SQL expression
* ~~**references**~~ (dict)
  * **object\_type** (str) - reference object type (e.g. `TABLE`, `EXTERNAL_TABLE`)
  * **object\_name** (ident) - reference object name
  * **columns** (list)
    * *{items}* (ident) - reference column names
* **comment** (str)&#x20;

## Usage notes

1. Management of row access policies requires active warehouse due to unavoidable [POLICY\_REFERENCES](https://docs.snowflake.com/en/sql-reference/functions/policy_references.html) table function calls.
2. Row access policies always return `BOOLEAN`.
3. Snowflake documentation is incorrect. It is only possible to have one row access policy per object.
4. If **arguments** of policy was changed, all references will be dropped, policy will be re-created from scratch, and all references will be restored. Also, when other objects are being re-created, such objects will initially lack policy references.\
   \
   Business users might be able to access objects without protection of policy in such case. There is no way to avoid it due to fundamental lack of transaction support for DDL queries in Snowflake.\
   \
   You may consider having weekly "safe maintenance" time slots to apply DDL when business users won't be able to access Snowflake account.
5. 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 ROW ACCESS POLICY](https://docs.snowflake.com/en/sql-reference/sql/create-row-access-policy.html)
* [SHOW ROW ACCESS POLICIES](https://docs.snowflake.com/en/sql-reference/sql/show-row-access-policies.html)
* [DESC ROW ACCESS POLICY](https://docs.snowflake.com/en/sql-reference/sql/desc-row-access-policy.html)
* [Parser & JSON Schema (GitHub)](https://github.com/littleK0i/SnowDDL/blob/master/snowddl/parser/row_access_policy.py)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snowddl.com/basic/yaml-configs/row-access-policy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
