From 99dec8c714c542f9a880b8d929987d3350c60bd2 Mon Sep 17 00:00:00 2001 From: Teghan Nightengale Date: Mon, 3 Apr 2023 10:48:15 -0400 Subject: [PATCH] fix: check columns against columns() not strings (#27) ## Description - fixes a bug where the included columns were not being cast correctly --- README.md | 2 +- dbt_project.yml | 2 +- macros/utils/aggregations/_min_or_max.sql | 10 +++++----- pyproject.toml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 568e709..427af6f 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Include in `packages.yml`: ```yaml packages: - package: tnightengale/dbt_activity_schema - version: 0.3.2 + version: 0.3.3 ``` For latest release, see https://github.com/tnightengale/dbt-activity-schema/releases. diff --git a/dbt_project.yml b/dbt_project.yml index 9ccd26f..4452581 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,7 +1,7 @@ # Project name. name: 'dbt_activity_schema' -version: '0.3.2' +version: '0.3.3' config-version: 2 require-dbt-version: [">=1.3.0", "<2.0.0"] diff --git a/macros/utils/aggregations/_min_or_max.sql b/macros/utils/aggregations/_min_or_max.sql index 00749e5..7041719 100644 --- a/macros/utils/aggregations/_min_or_max.sql +++ b/macros/utils/aggregations/_min_or_max.sql @@ -2,20 +2,20 @@ {% set aggregation = "min" if min_or_max == "min" else "max" %} {% set column_name = qualified_col.split(".")[-1].strip() %} - {% set qualified_ts_col = "{}.{}".format(dbt_activity_schema.appended(), dbt_activity_schema.columns().ts )%} +{% set columns = dbt_activity_schema.columns() %} {# Set type to cast back to after aggregation. #} {# TODO: Refactor column abstraction to contain types. #} {% if column_name in [ - "ts", - "activity_repeated_at" + columns.ts, + columns.activity_repeated_at ] %} {% set type = dbt.type_timestamp() %} {% elif column_name in [ - "activity_occurrence", - "revenue_impact" + columns.activity_occurrence, + columns.revenue_impact ] %} {% set type = dbt.type_numeric() %} {% else %} diff --git a/pyproject.toml b/pyproject.toml index fa8f1e7..a514a00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dbt-activity-schema" -version = "0.3.2" +version = "0.3.3" description = "A dbt package to create models within the Activity Schema data model framework." authors = ["Teghan Nightengale "] license = "GNU"