Add more patterns for language extraction

This commit is contained in:
Anna Saiapina 2024-07-09 09:47:40 +00:00 committed by GCP Dataform
parent bc7acf150f
commit 2e068f0859

View File

@ -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
on upper(l.LANGUAGES) = upper(ml.LANGUAGE)