Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split quoting behaviour for Snowflake between column identifiers and other identifiers #194

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion macros/utils.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{% endmacro %}

{% macro quote_and_join_columns(columns) %}
{% set columns = dbt_unit_testing.map(columns, dbt_unit_testing.quote_identifier) | join(",") %}
{% set columns = dbt_unit_testing.map(columns, dbt_unit_testing.quote_column_identifier) | join(",") %}
{{ return (columns) }}
{% endmacro %}

Expand Down Expand Up @@ -133,6 +133,22 @@
{{ return (dbt_unit_testing.merge_jsons([unit_tests_config] + configs)) }}
{% endmacro %}

{% macro quote_column_identifier(identifier) %}
{{ return(adapter.dispatch('quote_column_identifier','dbt_unit_testing')(identifier)) }}
{% endmacro %}

{% macro default__quote_column_identifier(identifier) -%}
{{ return(quote_identifier(identifier)) }}
{%- endmacro %}

{% macro snowflake__quote_column_identifier(identifier) %}
{% if identifier.startswith('"') %}
{{ return(identifier) }}
{% else %}
{{ return('"' ~ identifier ~ '"') }}
{% endif %}
{% endmacro %}

{% macro quote_identifier(identifier) %}
{{ return(adapter.dispatch('quote_identifier','dbt_unit_testing')(identifier)) }}
{% endmacro %}
Expand Down
Loading