{%- set nested_properties = [
  "referrer",
  "href",
  "host",
  "pathname",
  "search"
] -%}

cubes:
  - name: cube_02
    sql: >
      SELECT
      {%- for prop in nested_properties %}
        {{ prop | safe }}_prop.value AS {{ prop | safe }}
      {%- endfor %}
      FROM public.events
      {%- for prop in nested_properties %}
      LEFT JOIN UNNEST(properties) AS {{ prop | safe }}_prop ON {{ prop | safe }}_prop.key = '{{ prop | safe }}'
      {%- endfor %}