The problem I’m having
I have a snowflake function that I’m trying to convert to a dbt macro. I don’t think dbt has the capability to do it. I want to have the functionality inside dbt and not calling a function within snowflake
What I’ve already tried
{% macro remove_special_characters(string) %}
REPLACE( {{ string }}, '\\p{Diacritic}', '' )
{% endmacro %}
This is the snowflake function I have inside dbt.
CREATE OR REPLACE FUNCTION {{env_var('DBT_DATABASE')}}.{{env_var('DBT_SCHEMA')}}.REMOVE_DIACRITIC_CHARS(DIACRITIC_CHAR STRING)
RETURNS VARCHAR(16777216)
LANGUAGE JAVASCRIPT
AS '
TRANSFORMED_CHAR = DIACRITIC_CHAR.normalize("NFD").replace(/\\p{Diacritic}/gu, "");
return TRANSFORMED_CHAR;
';