Skip to content

Commit

Permalink
Merge pull request #101 from ScalefreeCOM/support_md5_binary
Browse files Browse the repository at this point in the history
Added md5 binary support (Snowflake)
  • Loading branch information
tkirschke authored Jul 24, 2023
2 parents 4a791f2 + e68cdcd commit 871dd9b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions macros/supporting/hash_default_values.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@

{{ log('hash datatype: ' ~ hash_datatype, false) }}

{%- if hash_function == 'MD5' and hash_datatype == 'STRING' -%}
{%- set hash_alg = 'MD5' -%}
{%- set unknown_key = '!00000000000000000000000000000000' -%}
{%- set error_key = '!ffffffffffffffffffffffffffffffff' -%}
{%- if hash_function == 'MD5' or hash_function == 'MD5_HEX' -%}
{%- if 'VARCHAR' in hash_datatype or 'CHAR' in hash_datatype or 'STRING' in hash_datatype or 'TEXT' in hash_datatype %}
{%- set hash_alg = 'MD5' -%}
{%- set unknown_key = '!00000000000000000000000000000000' -%}
{%- set error_key = '!ffffffffffffffffffffffffffffffff' -%}
{%- elif 'BINARY' in hash_datatype -%}
{%- set hash_alg = 'MD5_BINARY' -%}
{%- set unknown_key = "TO_BINARY('00000000000000000000000000000000')" -%}
{%- set error_key = "TO_BINARY('ffffffffffffffffffffffffffffffff')" -%}
{%- endif -%}
{%- elif hash_function == 'SHA1' or hash_function == 'SHA1_HEX' or hash_function == 'SHA' -%}
{%- if 'VARCHAR' in hash_datatype or 'CHAR' in hash_datatype or 'STRING' in hash_datatype or 'TEXT' in hash_datatype %}
{%- set hash_alg = 'SHA1' -%}
Expand Down Expand Up @@ -101,4 +107,4 @@
{{ return(dict_result | tojson ) }}


{%- endmacro -%}
{%- endmacro -%}

0 comments on commit 871dd9b

Please sign in to comment.