From 79e0eaed7dd6bc0472d1770a3ea26dbf2c20547b Mon Sep 17 00:00:00 2001 From: Christophe Duong Date: Mon, 5 Apr 2021 20:31:40 +0200 Subject: [PATCH 1/2] Postgres also have an alternative concat binary operation (#296) --- macros/cross_db_utils/concat.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macros/cross_db_utils/concat.sql b/macros/cross_db_utils/concat.sql index 32443cbd..b75650b0 100644 --- a/macros/cross_db_utils/concat.sql +++ b/macros/cross_db_utils/concat.sql @@ -13,6 +13,11 @@ {% endmacro %} +{% macro postgres__concat(fields) %} + {{ dbt_utils.alternative_concat(fields) }} +{% endmacro %} + + {% macro redshift__concat(fields) %} {{ dbt_utils.alternative_concat(fields) }} {% endmacro %} From 9d1d24dcd974cb8b2801c021790a41c4d0af08c6 Mon Sep 17 00:00:00 2001 From: Claire Carroll <20294432+clrcrl@users.noreply.github.com> Date: Wed, 19 May 2021 12:04:27 -0400 Subject: [PATCH 2/2] Update default implementation of concat macro --- CHANGELOG.md | 1 + macros/cross_db_utils/concat.sql | 21 +-------------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0382042d..de3f42c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ If you were relying on the position to match up your optional arguments, this ma ## Under the hood +* Update the default implementation of concat macro to use `||` operator ([#373](https://github.com/fishtown-analytics/dbt-utils/pull/314) [@ChristopheDuong](https://github.com/ChristopheDuong)). Note this may be a breaking change for spark users. # dbt-utils v0.6.5 ## Features diff --git a/macros/cross_db_utils/concat.sql b/macros/cross_db_utils/concat.sql index b75650b0..7f26e369 100644 --- a/macros/cross_db_utils/concat.sql +++ b/macros/cross_db_utils/concat.sql @@ -5,24 +5,5 @@ {%- endmacro %} {% macro default__concat(fields) -%} - concat({{ fields|join(', ') }}) -{%- endmacro %} - -{% macro alternative_concat(fields) %} {{ fields|join(' || ') }} -{% endmacro %} - - -{% macro postgres__concat(fields) %} - {{ dbt_utils.alternative_concat(fields) }} -{% endmacro %} - - -{% macro redshift__concat(fields) %} - {{ dbt_utils.alternative_concat(fields) }} -{% endmacro %} - - -{% macro snowflake__concat(fields) %} - {{ dbt_utils.alternative_concat(fields) }} -{% endmacro %} +{%- endmacro %}