# MATERIALIZED VIEW

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

Example:

```yaml
text: |-
  SELECT id, name
  FROM test_ext_table_1

is_secure: true
```

## Schema

* **columns** (dict)
  * *{key}* (ident) - column name
  * *{value}* (str) - column comment
* <mark style="background-color:red;">**text**</mark> (str) - view text
* **is\_secure** (bool) - is view secure
* **cluster\_by** (list)
  * *{items}* (str) - SQL expressions for CLUSTER BY
* **comment** (str)

## Usage notes

1. If you include **cluster\_by**, **columns** are also required.
2. Maintenance of materialized views implicitly incurs [additional costs](https://docs.snowflake.com/en/user-guide/views-materialized.html#label-materialized-views-maintenance-billing).
3. Invalid materialized views will be re-created automatically.

## Links

* [CREATE MATERIALIZED VIEW](https://docs.snowflake.com/en/sql-reference/sql/create-materialized-view.html)
* [SHOW MATERIALIZED VIEWS](https://docs.snowflake.com/en/sql-reference/sql/show-materialized-views.html)
* [Working with Materialized Views](https://docs.snowflake.com/en/user-guide/views-materialized.html)
* [Parser & JSON Schema (GitHub)](https://github.com/littleK0i/SnowDDL/blob/master/snowddl/parser/materialized_view.py)
