Skip to content

Commit 23d78b7

Browse files
author
Michael Myaskovsky
committed
changed the jinja boolean conversions
1 parent 6b2dd64 commit 23d78b7

File tree

3 files changed

+17
-34
lines changed

3 files changed

+17
-34
lines changed

macros/edr/dbt_artifacts/upload_dbt_invocation.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'command': flags.WHICH,
1818
'dbt_version': dbt_version,
1919
'elementary_version': elementary.get_elementary_package_version(),
20-
'full_refresh': edr_evaluate_bool(flags.FULL_REFRESH),
20+
'full_refresh': edr_evaluate_bool_condition(flags.FULL_REFRESH),
2121
'invocation_vars': elementary.get_invocation_vars(),
2222
'vars': elementary.get_all_vars(),
2323
'target_name': target.name,

macros/edr/dbt_artifacts/upload_run_results.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636
{{ return(dbt_run_results_empty_table_query) }}
3737
{% endmacro %}
3838

39+
{% macro debug_var(var_name, var_value) %}
40+
{% do log("🔍 DEBUG — " ~ var_name ~ ": " ~ var_value, info=True) %}
41+
{% endmacro %}
3942
{% macro flatten_run_result(run_result) %}
4043
{% set run_result_dict = elementary.get_run_result_dict(run_result) %}
4144
{% set node = elementary.safe_get_with_default(run_result_dict, 'node', {}) %}
4245
{% set config_dict = elementary.safe_get_with_default(node, 'config', {}) %}
46+
{{ debug()}}
4347
{% set flatten_run_result_dict = {
4448
'model_execution_id': elementary.get_node_execution_id(node),
4549
'invocation_id': invocation_id,
@@ -55,7 +59,7 @@
5559
'execute_completed_at': none,
5660
'compile_started_at': none,
5761
'compile_completed_at': none,
58-
'full_refresh': edr_evaluate_bool(flags.FULL_REFRESH),
62+
'full_refresh': edr_evaluate_bool_condition(flags.FULL_REFRESH),
5963
'compiled_code': elementary.get_compiled_code(node, as_column_value=true),
6064
'failures': run_result_dict.get('failures'),
6165
'query_id': run_result_dict.get('adapter_response', {}).get('query_id'),
Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
{# Evaluate bool - For jinja bool true/false evaluation towards DBs compatible bool type#}
2-
{% macro edr_evaluate_bool(return_value) -%}
3-
{%- if return_value == true -%} {{ edr_bool_true() }}
4-
{%- else -%} {{ edr_bool_false() }}
5-
{%- endif -%}
6-
{%- endmacro %}
7-
8-
{% macro edr_evaluate_bool_condition(return_value) -%}
9-
{%- if return_value == true -%} {{ edr_bool_true_condition() }}
10-
{%- else -%} {{ edr_bool_false_condition() }}
11-
{%- endif -%}
12-
{%- endmacro %}
132

143
{# Due to "faking" of bool using bit in T-SQL we have distinguish representation of true/false #}
154
{# We have different bools for use in parameter wheres vs. in columns as values#}
@@ -21,35 +10,25 @@
2110
{{ return(adapter.dispatch('edr_bool_true', 'elementary')()) }}
2211
{%- endmacro %}
2312

24-
{% macro default__edr_bool_true() %}true{% endmacro %}
25-
26-
{% macro fabric__edr_bool_true() %}1{% endmacro %}
27-
28-
29-
{% macro edr_bool_true_condition() -%}
30-
{{ return(adapter.dispatch('edr_bool_true_condition', 'elementary')()) }}
31-
{%- endmacro %}
32-
33-
{% macro default__edr_bool_true_condition() %}true{% endmacro %}
34-
35-
{% macro fabric__edr_bool_true_condition() %}1 = 1{% endmacro %}
36-
3713
{# False bools#}
3814

3915
{% macro edr_bool_false() -%}
4016
{{ return(adapter.dispatch('edr_bool_false', 'elementary')()) }}
4117
{%- endmacro %}
4218

43-
{% macro default__edr_bool_false() %}false{% endmacro %}
44-
45-
{% macro fabric__edr_bool_false() %}0{% endmacro %}
19+
{% macro edr_evaluate_bool_condition(return_value) %}
20+
{% if return_value == true %}
21+
{{ return(adapter.dispatch('edr_bool_true', 'elementary')()) }}
22+
{% else %}
23+
{{ return(adapter.dispatch('edr_bool_false', 'elementary')()) }}
24+
{% endif %}
25+
{%endmacro%}
4626

4727

28+
{% macro default__edr_bool_true() %}{%do return(true)%}{% endmacro %}
4829

49-
{% macro edr_bool_false_condition() -%}
50-
{{ return(adapter.dispatch('edr_bool_false_condition', 'elementary')()) }}
51-
{%- endmacro %}
30+
{% macro fabric__edr_bool_true() %}1{% endmacro %}
5231

53-
{% macro default__edr_bool_false_condition() %}false{% endmacro %}
32+
{% macro default__edr_bool_false() %}{%do return(false)%}{% endmacro %}
5433

55-
{% macro fabric__edr_bool_false_condition() %}0 = 1{% endmacro %}
34+
{% macro fabric__edr_bool_false() %}0{% endmacro %}

0 commit comments

Comments
 (0)