Skip to content

Commit

Permalink
make star macro work with ref or schema.table
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Oct 30, 2017
1 parent 2f151b8 commit 2884e94
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions macros/sql/star.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{% macro star(from, except=[]) -%}

{%- set table_parts = from.split('.') %}
{%- if from.name -%}
{%- set schema_name, table_name = from.schema, from.name -%}
{%- else -%}
{%- set schema_name, table_name = (from | string).split(".") -%}
{%- endif -%}

{%- set include_cols = [] %}
{%- set cols = adapter.get_columns_in_table(*table_parts) %}
{%- set cols = adapter.get_columns_in_table(schema_name, table_name) -%}
{%- for col in cols -%}

{%- if col.column not in except -%}
Expand Down

0 comments on commit 2884e94

Please sign in to comment.