|
1 |
| -{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%} |
2 |
| - {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }} |
3 |
| -{% endmacro %} |
4 |
| - |
5 |
| -{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%} |
6 |
| - {%- do dbt_utils._is_relation(from, 'star') -%} |
7 |
| - {%- do dbt_utils._is_ephemeral(from, 'star') -%} |
8 |
| - |
9 |
| - {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} |
10 |
| - {%- if not execute -%} |
11 |
| - {{ return('*') }} |
12 |
| - {%- endif -%} |
13 |
| - |
14 |
| - {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %} |
15 |
| - |
16 |
| - {%- if cols|length <= 0 -%} |
17 |
| - {{- return('*') -}} |
18 |
| - {%- else -%} |
19 |
| - {%- for col in cols %} |
20 |
| - {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%} |
21 |
| - {%- if not loop.last %},{{ '\n ' }}{% endif %} |
22 |
| - {%- endfor -%} |
23 |
| - {% endif %} |
24 |
| -{%- endmacro %} |
| 1 | +{% macro star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%} |
| 2 | + {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix, quote_identifiers)) }} |
| 3 | +{% endmacro %} |
| 4 | + |
| 5 | +{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='', quote_identifiers=True) -%} |
| 6 | + {%- do dbt_utils._is_relation(from, 'star') -%} |
| 7 | + {%- do dbt_utils._is_ephemeral(from, 'star') -%} |
| 8 | + |
| 9 | + {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} |
| 10 | + {%- if not execute -%} |
| 11 | + {{ return('*') }} |
| 12 | + {%- endif -%} |
| 13 | + |
| 14 | + {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %} |
| 15 | + |
| 16 | + {%- if cols|length <= 0 -%} |
| 17 | + {{- return('*') -}} |
| 18 | + {%- else -%} |
| 19 | + {%- for col in cols %} |
| 20 | + {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%} |
| 21 | + {%- if quote_identifiers -%} |
| 22 | + {{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%} |
| 23 | + {%- else -%} |
| 24 | + {{ col|trim }} {%- if prefix!='' or suffix!='' %} as {{ (prefix ~ col ~ suffix)|trim }} {%- endif -%} |
| 25 | + {% endif %} |
| 26 | + {%- if not loop.last %},{{ '\n ' }}{%- endif -%} |
| 27 | + {%- endfor -%} |
| 28 | + {% endif %} |
| 29 | +{%- endmacro %} |
| 30 | + |
0 commit comments