Merged PR 3491: Allows possibility to retrieve claim as date or timestamp
# Description Allows code to retrieve NewDashMoveDate in the case of being a date or a timestamp. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [NA] I have checked for DRY opportunities with other models and docs. - [NA] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Allows possibility to retrieve claim as date or timestamp Related work items: #23980
This commit is contained in:
parent
cce5d2b9d6
commit
3b822a2ea5
1 changed files with 8 additions and 0 deletions
|
|
@ -16,10 +16,18 @@ with
|
||||||
ndu.new_dash_version,
|
ndu.new_dash_version,
|
||||||
min(
|
min(
|
||||||
case
|
case
|
||||||
|
-- If the claim_value contains a date, cast the date as timestamp
|
||||||
|
-- at 00:00:00
|
||||||
when
|
when
|
||||||
claim_value
|
claim_value
|
||||||
~ '^(20\d{2})-(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d|3[01])$'
|
~ '^(20\d{2})-(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d|3[01])$'
|
||||||
then cast(date(claim_value) as timestamp)
|
then cast(date(claim_value) as timestamp)
|
||||||
|
-- If the claim_value contains a timestamp, retrieve the timestamp
|
||||||
|
when
|
||||||
|
claim_value
|
||||||
|
~ '^(20\d{2})-(0[1-9]|1[0-2])-(0[1-9]|1\d|2\d|3[01])\s([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$'
|
||||||
|
then cast(claim_value as timestamp)
|
||||||
|
-- Return null otherwise
|
||||||
else null
|
else null
|
||||||
end
|
end
|
||||||
) as new_dash_move_at_utc
|
) as new_dash_move_at_utc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue