Skip to content

Commit 1d56973

Browse files
jonhopper-dataengineersCortex Code
andauthored
Fix unknown_member macro boolean type inference with explicit casts (#29)
Added ::boolean casts to is_current, is_deleted, and generic boolean columns in the unknown_member macro to ensure Snowflake correctly infers the column type when generating unknown member rows. .... Generated with [Cortex Code](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Cortex Code <noreply@snowflake.com>
1 parent 9f592cc commit 1d56973

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ integration_tests/target/
77
integration_tests/dbt_packages/
88
integration_tests/logs/
99
integration_tests/profiles.yml
10+
integration_tests/package-lock.yml
1011
plans/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Data Engineers Snowflake DataOps Utils Project Changelog
22
This file contains the changelog for the Data Engineers Snowflake DataOps Utils project, detailing updates, fixes, and enhancements made to the project over time.
33

4+
## v1.0.4 - 2026-05-21 - Unknown Member Boolean Cast Fix
5+
6+
### Fixed
7+
- Fixed `unknown_member` macro: added explicit `::boolean` casts for `is_current`, `is_deleted`, and generic boolean columns to ensure correct type inference in Snowflake when generating unknown member rows.
8+
9+
### Changed
10+
- Bumped version from 1.0.3 to 1.0.4
11+
412
## v1.0.3 - 2026-05-16 - Data Metric Function Cleanup Support
513

614
### Added

dbt_project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'dbt_dataengineers_utils'
2-
version: '1.0.3'
2+
version: '1.0.4'
33
config-version: 2
44

55
require-dbt-version: [">=1.9.4", "<3.0.0"]

macros/modelling/unknown_member.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
{%- elif column_names[i] == 'effective_to' %}
2727
to_timestamp_ltz('2999-12-31 23:59:59') as effective_to{{ line_end }}
2828
{%- elif column_names[i] == 'is_current' %}
29-
true as is_current{{ line_end }}
29+
true::boolean as is_current{{ line_end }}
3030
{%- elif column_names[i] == 'is_deleted' %}
31-
false as is_deleted{{ line_end }}
31+
false::boolean as is_deleted{{ line_end }}
3232
{%- elif 'finish' in column_names[i] and column_names[i].endswith('_date') and column_types[i]|upper in ['NUMBER', 'INT', 'INTEGER']%}
3333
29991231 as {{ column_names[i] }}{{ line_end }}
3434
{%- elif column_names[i].endswith('_date') and column_types[i]|upper in ['NUMBER', 'INT', 'INTEGER']%}
@@ -38,7 +38,7 @@
3838
{%- elif column_types[i]|upper in ['NUMBER','INT','DECIMAL']%}
3939
-1 as {{ column_names[i] }}{{ line_end }}
4040
{%- elif column_types[i]|upper in ['BOOLEAN']%}
41-
true as {{ column_names[i] }}{{ line_end }}
41+
true::boolean as {{ column_names[i] }}{{ line_end }}
4242
{%- else %}
4343
'Unknown' as {{ column_names[i] }}{{ line_end }}
4444
{%- endif %}

0 commit comments

Comments
 (0)