add table alias optional argument to macro
This commit is contained in:
parent
c0718daaa9
commit
002eadc362
1 changed files with 10 additions and 2 deletions
|
|
@ -9,6 +9,14 @@ It generates two output fields:
|
||||||
This macro is intended to be used within a SELECT statement
|
This macro is intended to be used within a SELECT statement
|
||||||
and ensures that the output is properly formatted for further analysis.
|
and ensures that the output is properly formatted for further analysis.
|
||||||
*/
|
*/
|
||||||
{% macro unix_ms_timestamp_to_utc(column_name) %}
|
{% 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'
|
to_timestamp({{ adapter.quote(column_name) }} / 1000) at time zone 'UTC'
|
||||||
|
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue