Skip to content

Commit

Permalink
fix: add quotes to the relation identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
cverhoef committed Apr 24, 2024
1 parent ede27c8 commit e3dbc76
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions macros/SQL_generators/star.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
{%- for column in columns -%}
{%- if column.name not in except -%}
{%- if target.type == 'databricks' -%}
{%- set selects = selects.append(relation.identifier + '.`' + column.name + '`') -%}
{%- set selects = selects.append('`' + relation.identifier + '`.`' + column.name + '`') -%}
{%- elif target.type in ('sqlserver', 'snowflake') -%}
{%- set selects = selects.append(relation.identifier + '."' + column.name + '"') -%}
{%- set selects = selects.append('"' + relation.identifier + '"."' + column.name + '"') -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
Expand All @@ -23,7 +23,11 @@
{%- endif -%}
{% endfor %}
{% else %}
{{ relation.identifier }}.*
{%- if target.type == 'databricks' -%}
`{{ relation.identifier }}`.*
{%- elif target.type in ('sqlserver', 'snowflake') -%}
"{{ relation.identifier }}".*
{%- endif -%}
{% endif %}

{% endmacro %}

0 comments on commit e3dbc76

Please sign in to comment.