Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (18 sloc) 775 Bytes
{% macro star(from, relation_alias=False, except=[]) -%}
{%- do dbt_utils._is_relation(from, 'star') -%}
{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}
{%- if not execute -%}
{{ return('') }}
{% endif %}
{%- set include_cols = [] %}
{%- set cols = adapter.get_columns_in_relation(from) -%}
{%- for col in cols -%}
{%- if col.column not in except -%}
{% set _ = include_cols.append(col.column) %}
{%- endif %}
{%- endfor %}
{%- for col in include_cols %}
{% if relation_alias %} {{ relation_alias }}.{% endif %} {{ dbt_utils.identifier(col) }} {% if not loop.last %},
{% endif %}
{%- endfor -%}
{%- endmacro %}
You can’t perform that action at this time.