Skip to content
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

Unable to lint query #263

Open
vincent-benefitflow opened this issue Jul 18, 2024 · 0 comments
Open

Unable to lint query #263

vincent-benefitflow opened this issue Jul 18, 2024 · 0 comments

Comments

@vincent-benefitflow
Copy link

{% macro replace_recursive() %}

CREATE OR REPLACE FUNCTION replace_recursive(search text, from_to text [] [])
RETURNS text LANGUAGE plpgsql AS $$
DECLARE
i integer;
result text := search;
BEGIN
FOR i IN 1 .. array_length(from_to, 1) LOOP
result := replace(result, from_to[i][1], from_to[i][2]);
END LOOP;
RETURN result;
END;
$$;

CREATE OR REPLACE FUNCTION replace_delimiters(search text, rep_val text)
RETURNS text LANGUAGE plpgsql AS $$
BEGIN
RETURN regexp_replace(search, '[,.|:;/\_-\t\r\n]', rep_val, 'g');
END;
$$;

{% endmacro %}

Postgres query in DBT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant