File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ Arguments:
13
13
14
14
{%- set exclude = exclude if exclude is not none else [] %}
15
15
16
+ {%- set include_cols = [] %}
17
+
16
18
{%- set table_columns = {} %}
17
19
18
20
{%- set _ = table_columns .update ({table: []}) %}
@@ -26,18 +28,22 @@ Arguments:
26
28
{%- set cols = adapter .get_columns_in_table (schema, table_name) %}
27
29
28
30
{%- for col in cols - %}
29
-
30
- {%- if col .column not in exclude - %}
31
- select
32
- {%- for exclude_col in exclude %}
33
- {{ exclude_col }},
34
- {%- endfor %}
35
- cast(' {{ col.column }}' as varchar ) as field_name,
36
- {{ dbt_utils .safe_cast (field= col .column , type= cast_to) }} as value
37
- from {{ table }}
38
- {% if not loop .last - %}
39
- union all
40
- {% endif - %}
41
- {%- endif - %}
31
+ {%- if col .column not in exclude - %}
32
+ {% set _ = include_cols .append (col) %}
33
+ {%- endif %}
34
+ {%- endfor %}
35
+
36
+ {%- for col in include_cols - %}
37
+
38
+ select
39
+ {%- for exclude_col in exclude %}
40
+ {{ exclude_col }},
41
+ {%- endfor %}
42
+ cast(' {{ col.column }}' as varchar ) as field_name,
43
+ {{ dbt_utils .safe_cast (field= col .column , type= cast_to) }} as value
44
+ from {{ table }}
45
+ {% if not loop .last - %}
46
+ union all
47
+ {% endif - %}
42
48
{%- endfor - %}
43
49
{%- endmacro %}
You can’t perform that action at this time.
0 commit comments