modified macro

This commit is contained in:
Joaquin Ossa 2024-10-04 08:42:28 +02:00
parent e9f16342e7
commit 751a95f9ae
2 changed files with 10 additions and 13 deletions

View file

@ -0,0 +1,14 @@
/*
This macro converts a timestamp column from Unix epoch time (in milliseconds)
to a UTC timestamp and a corresponding UTC date.
It generates two output fields:
1. The timestamp in UTC, with the alias formatted as <column_name>_at_utc.
2. The date in UTC, with the alias formatted as <column_name>_date_utc.
This macro is intended to be used within a SELECT statement
and ensures that the output is properly formatted for further analysis.
*/
{% macro unix_ms_timestamp_to_utc(column_name) %}
to_timestamp({{ adapter.quote(column_name) }} / 1000) at time zone 'UTC'
{% endmacro %}