Skip to content

Commit 945d310

Browse files
Merge pull request #851 from StevenReitsma/patch-1
Fix datetime casting macro for ClickHouse
2 parents cbabcb2 + 8152cd6 commit 945d310

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

macros/utils/data_types/cast_column.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323

2424
{%- macro clickhouse__edr_cast_as_timestamp(timestamp_field) -%}
2525
coalesce(
26-
toDateTime(
27-
left(splitByChar('+', toString({{ timestamp_field }}))[1], 19)),
28-
toDateTime('1970-01-01 00:00:00')
26+
parseDateTimeBestEffortOrNull(toString({{ timestamp_field }}), 'UTC'),
27+
toDateTime('1970-01-01 00:00:00', 'UTC')
2928
)
3029
{%- endmacro -%}
3130

0 commit comments

Comments
 (0)