From 5d8fee4fb1131c1a026bd56be4bb9114038c7091 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Thu, 2 May 2024 21:33:08 -0400 Subject: [PATCH 1/3] bm/dbt-precompiled-model-hash --- macros/query_comment.sql | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/macros/query_comment.sql b/macros/query_comment.sql index 6d80ba3..3e1c4df 100644 --- a/macros/query_comment.sql +++ b/macros/query_comment.sql @@ -53,36 +53,43 @@ materialized=node.config.materialized, ) -%} {%- endif -%} + + {# New step to add dbt_raw_code_hash if node.raw_code exists #} + {%- if node.raw_code is not none -%} + {%- do comment_dict.update({ + "dbt_raw_code_hash": local_md5(node.raw_code) + }) -%} + {%- endif -%} {%- endif -%} {%- if env_var('DBT_CLOUD_PROJECT_ID', False) -%} - {%- do comment_dict.update( - dbt_cloud_project_id=env_var('DBT_CLOUD_PROJECT_ID') - ) -%} + {%- do comment_dict.update( + dbt_cloud_project_id=env_var('DBT_CLOUD_PROJECT_ID') + ) -%} {%- endif -%} {%- if env_var('DBT_CLOUD_JOB_ID', False) -%} - {%- do comment_dict.update( - dbt_cloud_job_id=env_var('DBT_CLOUD_JOB_ID') - ) -%} + {%- do comment_dict.update( + dbt_cloud_job_id=env_var('DBT_CLOUD_JOB_ID') + ) -%} {%- endif -%} {%- if env_var('DBT_CLOUD_RUN_ID', False) -%} - {%- do comment_dict.update( - dbt_cloud_run_id=env_var('DBT_CLOUD_RUN_ID') - ) -%} + {%- do comment_dict.update( + dbt_cloud_run_id=env_var('DBT_CLOUD_RUN_ID') + ) -%} {%- endif -%} {%- if env_var('DBT_CLOUD_RUN_REASON_CATEGORY', False) -%} - {%- do comment_dict.update( - dbt_cloud_run_reason_category=env_var('DBT_CLOUD_RUN_REASON_CATEGORY') - ) -%} + {%- do comment_dict.update( + dbt_cloud_run_reason_category=env_var('DBT_CLOUD_RUN_REASON_CATEGORY') + ) -%} {%- endif -%} {%- if env_var('DBT_CLOUD_RUN_REASON', False) -%} - {%- do comment_dict.update( - dbt_cloud_run_reason=env_var('DBT_CLOUD_RUN_REASON') - ) -%} + {%- do comment_dict.update( + dbt_cloud_run_reason=env_var('DBT_CLOUD_RUN_REASON') + ) -%} {%- endif -%} {{ return(tojson(comment_dict)) }} From 2ee6270f61da80ab496eecc96c97712ed2c5a809 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Thu, 2 May 2024 21:46:10 -0400 Subject: [PATCH 2/3] remove comment --- macros/query_comment.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/query_comment.sql b/macros/query_comment.sql index 3e1c4df..96195a6 100644 --- a/macros/query_comment.sql +++ b/macros/query_comment.sql @@ -54,7 +54,6 @@ ) -%} {%- endif -%} - {# New step to add dbt_raw_code_hash if node.raw_code exists #} {%- if node.raw_code is not none -%} {%- do comment_dict.update({ "dbt_raw_code_hash": local_md5(node.raw_code) From a3137b708bf9ee3aaed99b19e2340406da4cf18c Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Tue, 14 May 2024 10:06:11 +0100 Subject: [PATCH 3/3] Remove dbt prefix --- macros/query_comment.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/query_comment.sql b/macros/query_comment.sql index 96195a6..197b345 100644 --- a/macros/query_comment.sql +++ b/macros/query_comment.sql @@ -56,7 +56,7 @@ {%- if node.raw_code is not none -%} {%- do comment_dict.update({ - "dbt_raw_code_hash": local_md5(node.raw_code) + "raw_code_hash": local_md5(node.raw_code) }) -%} {%- endif -%} {%- endif -%}