Array Expressions
Work with array/multi-value fields.
Overview
Array expressions indicate that a field contains array values. Use for database columns that are arrays or JSON arrays.
Basic Syntax
expression:
array: true
sql: array_column
When to Use
Use array expressions for:
- Database array columns (PostgreSQL arrays)
- JSON array fields
- Multi-value dimensions
Example
- type: dimension
name: Tags
data_type: string
expression:
array: true
sql: tag_array
PostgreSQL Arrays
For PostgreSQL array columns:
- type: dimension
name: Product Tags
data_type: string
expression:
array: true
sql: tags # PostgreSQL array column
JSON Arrays
For JSON array fields:
- type: dimension
name: Categories
data_type: string
expression:
array: true
sql: json_extract_path_text(categories, 'items') # JSON array
Best Practices
- Use for multi-value fields - When a field can have multiple values
- Test array handling - Verify arrays work in your queries
- Document array structure - Add descriptions explaining array format
Next Steps
- Learn about SQL expressions
- Explore lookup expressions
- Understand dimensions