Arrays
Configuration for array attributes in code generation, including table creation, relationship types and joins, custom aliases for tables and views, and security policies for array tables.
Overview
Arrays metadata configures how array attributes are handled in code generation, including table creation, relationships, and aliases. Only applicable to semi-structured data sources with array attributes.
Array Configuration Fields
Include In Code Gen (INCLUDE_IN_CODE_GEN)
Boolean for including array in SQL code generation
Editable -
TRUE= Dynamic Table created,FALSE= excludedChild attributes only generated if parent array is included (
PARENT_INCLUDE_IN_CODE_GEN = TRUE)
Create Object Name Alias Name (CREATE_OBJECT_NAME_ALIAS_NAME)
Custom alias for materialized Dynamic Table created for this array
Editable - Overrides default name (typically
{array_name}_array_object)Example:
orders→ defaultorders_array_object, customorder_items
Semantic Layer Alias Name (SEMANTIC_LAYER_ALIAS_NAME)
Custom alias for array in semantic layer views
Editable - Overrides materialized table name in views
Relationship Name (RELATIONSHIP_NAME)
Name of relationship for this array
Editable - Used for documentation
Relationship Description (RELATIONSHIP_DESCRIPTION)
Description of relationship
Editable - Documents business logic
Relationship Type (RELATIONSHIP_TYPE)
Type of relationship between array and parent
Editable - Values:
'many_to_one'(most common),'one_to_one'
Join Type (JOIN_TYPE)
Type of join used in relationship
Editable - Values:
'left_outer'(include all parents),'inner'(only parents with array data)
Array Security Row Level Policy Name Semantic Layer (ARRAY_SECURITY_ROW_LEVEL_POLICY_NAME_SEMANTIC_LAYER)
Name of row-level security policy for array tables in semantic layer views
Editable - Applied to array tables in generated views
Requires Security Policy Integration product tier
Reference Fields (Read-only)
Shown for reference in Arrays section:
ATTRIBUTE_PATH- Path to array attributePOLYMORPHIC_ATTRIBUTE_NAME- Version nameARRAY_TYPE-'object','primitive', or'primitive,object'SOURCE_DATA_TYPE- Always'array'for array attributesPARENT_ARRAY- Parent array if nested
Array Table Generation
When INCLUDE_IN_CODE_GEN = TRUE:
Root Table - Contains parent record data
Array Table - Separate Dynamic Table for array contents
Named using
CREATE_OBJECT_NAME_ALIAS_NAMEor defaultContains all attributes from array elements
Includes foreign key columns (configured in Foreign Keys section)
Relationship - Foreign key relationship links array table to root table
Based on
RELATIONSHIP_TYPEandJOIN_TYPE
Array Types
Object Arrays (ARRAY_TYPE = 'object'):
Each element is an object with attributes
Creates separate table with all element attributes
Supports foreign key relationships
Configure:
INCLUDE_IN_CODE_GEN = TRUE, relationship type/join type, foreign keys
Primitive Arrays (ARRAY_TYPE = 'primitive'):
Elements are simple values (strings, numbers, booleans)
May be stored as VARIANT or ARRAY types in root table
May be flattened into separate table depending on configuration
Polymorphic Arrays (ARRAY_TYPE = 'primitive,object'):
Contains both objects and primitives
Both
array_primitiveandarray_objectversions may be activeConfigure each version separately
Best Practices
Naming:
Use descriptive, business-friendly names for
CREATE_OBJECT_NAME_ALIAS_NAMEUse clear relationship names in
RELATIONSHIP_NAME
Relationship configuration:
Many-to-One: Standard array relationships (most common)
One-to-One: Optional single-element arrays (less common)
Left Outer: Include all parents (most common)
Inner: Only parents with array data
Performance:
Set
INCLUDE_IN_CODE_GEN = FALSEfor unused arraysReduces table count and improves refresh performance
Large arrays may impact performance; monitor Dynamic Table refresh times
Common Scenarios
Configuring order items array:
Set
INCLUDE_IN_CODE_GEN = TRUESet
CREATE_OBJECT_NAME_ALIAS_NAME = 'order_items'Set
RELATIONSHIP_NAME = 'Orders to Items'(optional)Set
RELATIONSHIP_TYPE = 'many_to_one'Set
JOIN_TYPE = 'left_outer'Configure foreign keys in Foreign Keys section
Excluding unused arrays:
Set
INCLUDE_IN_CODE_GEN = FALSEArray table won't be generated; reduces schema complexity and improves performance
Nested arrays:
Configure parent array first
Configure nested array separately
PARENT_ARRAYreference set automaticallyConfigure foreign keys for each level
Array security:
Set
ARRAY_SECURITY_ROW_LEVEL_POLICY_NAME_SEMANTIC_LAYERCreate policy in Snowflake
Policy applied to array table in views
Last updated
Was this helpful?