From a85f81e95f743a766cb11ed7c15c39737c015035 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 2 Jun 2020 12:14:48 -0400 Subject: [PATCH] regex fix --- models/stg_marketo__lead_describe.sql | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/models/stg_marketo__lead_describe.sql b/models/stg_marketo__lead_describe.sql index 44be656..0bcf8e1 100644 --- a/models/stg_marketo__lead_describe.sql +++ b/models/stg_marketo__lead_describe.sql @@ -16,7 +16,17 @@ with base as ( soapread_only as is_soap_readonly from base +), regex as ( + + select + *, + case + when rest_name like '%\\_\\_c%' then lower(rest_name) + else ltrim(lower(regexp_replace(rest_name, "[A-Z]",'_\\0')),'_') + end as rest_name_xf + from fields + ) select * -from fields \ No newline at end of file +from regex \ No newline at end of file