Skip to content

Commit

Permalink
chore: allow optional whitespace in multi mv implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-awd committed Jan 17, 2025
1 parent 67bb498 commit 53b20a2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
{{ run_hooks(pre_hooks, inside_transaction=True) }}

-- extract the names of the materialized views from the sql
{% set view_names = modules.re.findall('--([^:]+):begin', sql) %}
{% set view_names = modules.re.findall('--(?:\s)?([^:]+):begin', sql) %}

-- extract the sql for each of the materialized view into a map
{% set views = {} %}
{% if view_names %}
{% for view_name in view_names %}
{% set view_sql = modules.re.findall('--' + view_name + ':begin(.*)--' + view_name + ':end', sql, flags=modules.re.DOTALL)[0] %}
{% set view_sql = modules.re.findall('--(?:\s)?' + view_name + ':begin(.*)--(?:\s)?' + view_name + ':end', sql, flags=modules.re.DOTALL)[0] %}
{%- set _ = views.update({view_name: view_sql}) -%}
{% endfor %}
{% else %}
Expand Down

0 comments on commit 53b20a2

Please sign in to comment.