diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eafeb23..d19747b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,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) from [@ChristopheDuong](https://github.com/ChristopheDuong)). Note this may be a breaking change for adapters that support `concat()` but not `||`, such as Apache Spark. - Use `power()` instead of `pow()` in `generate_series()` and `haversine_distance()` as they are synonyms in most SQL dialects, but some dialects only have `power()` ([#354](https://github.com/fishtown-analytics/dbt-utils/pull/354) from [@swanderz](https://github.com/swanderz)) +- Make `get_column_values` return the default value passed as a parameter instead of an empty string before compilation ([#304](https://github.com/dbt-labs/dbt-utils/pull/386) from [@jmriego](https://github.com/jmriego) # dbt-utils v0.6.6 diff --git a/dbt_project.yml b/dbt_project.yml index e5d5f93a..c2a2c1aa 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,7 +1,7 @@ name: 'dbt_utils' version: '0.1.0' -require-dbt-version: [">=0.20.0", "<0.21.0"] +require-dbt-version: [">=0.20.0", "<=1.0.0"] config-version: 2 diff --git a/macros/sql/get_column_values.sql b/macros/sql/get_column_values.sql index ee457de0..e105b7f0 100644 --- a/macros/sql/get_column_values.sql +++ b/macros/sql/get_column_values.sql @@ -3,10 +3,12 @@ {% endmacro %} {% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%} - +{% if default is none %} + {% set default = [] %} +{% endif %} {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #} {%- if not execute -%} - {{ return('') }} + {{ return(default) }} {% endif %} {%- set target_relation = adapter.get_relation(database=table.database,