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

@ -16,6 +16,12 @@ with LANGS as (
case case
when strpos(AGENT_NAME, '-- ') > 0 when strpos(AGENT_NAME, '-- ') > 0
then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 3) 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 else null
end AS LANGUAGES end AS LANGUAGES
from ${ref("stg_digital")} from ${ref("stg_digital")}
@ -26,6 +32,12 @@ with LANGS as (
case case
when strpos(AGENT_NAME, '-- ') > 0 when strpos(AGENT_NAME, '-- ') > 0
then substr(AGENT_NAME, strpos(AGENT_NAME, '--') + 3) 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 else null
end AS LANGUAGES end AS LANGUAGES
from ${ref("stg_calls")}) from ${ref("stg_calls")})
@ -41,4 +53,4 @@ from LANGS l
left join ${ref("stg_MAPPING_AGENT_GROUP")} ag left join ${ref("stg_MAPPING_AGENT_GROUP")} ag
on l.AGENT_GROUP = ag.AGENT_GROUP on l.AGENT_GROUP = ag.AGENT_GROUP
left join ${ref("stg_MAPPING_LANGUAGES")} ml left join ${ref("stg_MAPPING_LANGUAGES")} ml
on l.LANGUAGES = ml.LANGUAGE on upper(l.LANGUAGES) = upper(ml.LANGUAGE)