From 2e068f085990b44a180ba9b1c3ae015be33a1673 Mon Sep 17 00:00:00 2001 From: Anna Saiapina Date: Tue, 9 Jul 2024 09:47:40 +0000 Subject: [PATCH] Add more patterns for language extraction --- definitions/staging/stg_AGENT.sqlx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/definitions/staging/stg_AGENT.sqlx b/definitions/staging/stg_AGENT.sqlx index 412256a..f173ee1 100644 --- a/definitions/staging/stg_AGENT.sqlx +++ b/definitions/staging/stg_AGENT.sqlx @@ -14,8 +14,14 @@ with LANGS as ( AGENT_NAME, AGENT_GROUP, case - when strpos(AGENT_NAME, '--') > 0 + when strpos(AGENT_NAME, '-- ') > 0 then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 3) + when strpos(AGENT_NAME, '--') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 2) + when strpos(AGENT_NAME, '- ') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '-') + 2) + when strpos(AGENT_NAME, '-') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '-') + 1) else null end AS LANGUAGES from ${ref("stg_digital")} @@ -24,8 +30,14 @@ with LANGS as ( AGENT_NAME, AGENT_GROUP, case - when strpos(AGENT_NAME, '--') > 0 + when strpos(AGENT_NAME, '-- ') > 0 then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 3) + when strpos(AGENT_NAME, '--') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 2) + when strpos(AGENT_NAME, '- ') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '-') + 2) + when strpos(AGENT_NAME, '-') > 0 + then substr(AGENT_NAME, strpos(AGENT_NAME, '-') + 1) else null end AS LANGUAGES from ${ref("stg_calls")}) @@ -41,4 +53,4 @@ from LANGS l left join ${ref("stg_MAPPING_AGENT_GROUP")} ag on l.AGENT_GROUP = ag.AGENT_GROUP left join ${ref("stg_MAPPING_LANGUAGES")} ml -on l.LANGUAGES = ml.LANGUAGE \ No newline at end of file +on upper(l.LANGUAGES) = upper(ml.LANGUAGE) \ No newline at end of file