8000 Add Trino md5 macro by clausherther · Pull Request #301 · calogica/dbt-expectations · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Trino md5 macro #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ with column_values as (
unpivot_columns as (

{% for column in columns %}
select row_index, '{{ column }}' as column_name, md5({{ column }}) as column_value from column_values
select row_index, '{{ column }}' as column_name, {{ dbt_expectations.md5(column) }} as column_value from column_values
{% if not loop.last %}union all{% endif %}
{% endfor %}
),
Expand Down
16 changes: 16 additions & 0 deletions macros/utils/md5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{%- macro md5(string_value) -%}
{{ return(adapter.dispatch('md5', 'dbt_expectations')(string_value)) }}
{% endmacro %}

{%- macro default__md5(string_value) -%}

{{ dbt.hash(string_value) }}

{%- endmacro -%}


{%- macro trino__md5(string_value) -%}

md5(cast({{ string_value }} as varbinary))

{%- endmacro -%}
0