# Secure View Settings

Configuration for generating secure views (secure view layer) from materialized Dynamic Tables.

## Overview

Secure View Settings configure the generation of secure views or materialized views that provide a secure view layer on top of materialized Dynamic Tables. These views can incorporate Row Access Policies for security and are used for secure view layer access and Cortex Analyst integration.

**Feature Requirements:**

* Semantic Model Generator feature must be enabled (automatically enables Pipeline Designer, SQL Code Generation, and Data Dictionary Builder)
* SQL Code Generation automatically enabled with Semantic Model Generator

## View Type

The type of view object to generate for the secure view layer.

**Options:**

* **View** (Recommended) - Standard Snowflake views (virtual objects, no storage, always reflect current Dynamic Table data)
* **Materialized View** - Pre-computed views stored as tables (faster query performance, requires refresh, additional storage cost)

## Root View Name

The base name for the root-level secure view.

**Purpose:**

* Name for the root-level view
* Prefix for all nested array views (system automatically adds underscores for nested views)

**Requirements:**

* Required when View Type is selected
* Should be unique within deployment database/schema
* Must be valid Snowflake identifier

**Naming Pattern:**

* Root View: Uses the exact name provided (e.g., `CUSTOMER_EVENTS_VIEW`)
* Nested Array Views: Uses prefix with underscore and array attribute name (e.g., `CUSTOMER_EVENTS_VIEW_ITEMS` for items array)

## Deployment Location

The database and schema where secure views will be created.

**Secure View Deployment Database Name:**

* Optional field (if empty, uses Dynamic Table database)
* Should exist before code generation

**Secure View Deployment Schema Name:**

* Optional field (if empty, uses Dynamic Table schema)
* Should exist before code generation

**Note:** Deployment location can be different from Dynamic Table deployment location to separate materialized objects from the secure view layer.

## Row Access Policy

Configuration for Row-Level Security (RLS) on secure views.

**Primary Row Access Policy Name:**

* Name of the Row Access Policy applied to root secure view
* Enables row-level security based on user context
* Policy is applied in CREATE VIEW statement

**Requirements:**

* Policy must exist before code generation (or be created separately)
* Policy must be compatible with view structure
* Policy should reference attributes available in view

For more information: See [Snowflake Row Access Policies documentation](https://docs.snowflake.com/en/user-guide/security-row-intro)

## Optional Parameters

Additional parameters included in CREATE VIEW or CREATE MATERIALIZED VIEW statement. Allows fine-grained control over view behavior.

**Format:**

* Key-value pairs or SQL syntax
* Depends on view type
* See Snowflake documentation for available parameters

**Example:**

```
COMMENT='Customer Events Secure View'
```

## Configuration Requirements

**When View Type is Selected:**

* Root View Name is required
* Deployment location optional (defaults to Dynamic Table location)
* Row Access Policy optional but recommended for security

## Use Cases

**Secure View Layer:**

* Provide business-friendly view of data
* Abstract underlying Dynamic Table complexity
* Enable self-service analytics
* Standardize data access patterns

**Security Enforcement:**

* Apply Row Access Policies for data security
* Control data access by user/role
* Meet compliance requirements

**Cortex Analyst Integration:**

* Provide secure view layer for Cortex Analyst
* Enable natural language queries
* Support AI-powered analytics

## Summary

**Core Settings:**

* View Type (View or Materialized View)
* Root View Name (required when type selected)
* Deployment Location (optional, defaults to Dynamic Table location)

**Security Settings:**

* Primary Row Access Policy Name (optional but recommended)

**Advanced Settings:**

* Optional Parameters (optional)

**Requirements:**

* Semantic Model Generator feature must be enabled (automatically enables Pipeline Designer, SQL Code Generation, and Data Dictionary Builder)

For materialization settings, see [Materialization Settings](https://docs.datapancake.com/core-concepts/data-sources/materialization-settings). For Dynamic Table configuration, see [Dynamic Table Settings](https://docs.datapancake.com/core-concepts/data-sources/dynamic-table-settings).
