diff --git a/macros/unix_ms_timestamp_to_utc.sql b/macros/unix_ms_timestamp_to_utc.sql index e342ecd..2ea223a 100644 --- a/macros/unix_ms_timestamp_to_utc.sql +++ b/macros/unix_ms_timestamp_to_utc.sql @@ -9,6 +9,14 @@ It generates two output fields: 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' +{% macro unix_ms_timestamp_to_utc(column_name, table_alias=None) %} + {%- if table_alias -%} + to_timestamp( + {{ adapter.quote(table_alias) }}.{{ adapter.quote(column_name) }} / 1000 + ) at time zone 'UTC' + {%- else -%} + to_timestamp({{ adapter.quote(column_name) }} / 1000) at time zone 'UTC' + + {%- endif -%} + {% endmacro %}