modified macro
This commit is contained in:
parent
e9f16342e7
commit
751a95f9ae
2 changed files with 10 additions and 13 deletions
|
|
@ -9,15 +9,6 @@ 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 timestamp_to_utc(column_name) %}
|
{% macro unix_ms_timestamp_to_utc(column_name) %}
|
||||||
to_timestamp(
|
to_timestamp({{ adapter.quote(column_name) }} / 1000) at time zone 'UTC'
|
||||||
{{ adapter.quote(column_name) }}::double precision / 1000
|
|
||||||
) at time zone 'UTC'
|
|
||||||
as {{ column_name | replace("At", "") | replace("Date", "") }}_at_utc,
|
|
||||||
|
|
||||||
cast(
|
|
||||||
to_timestamp(
|
|
||||||
{{ adapter.quote(column_name) }}::double precision / 1000
|
|
||||||
) at time zone 'UTC' as date
|
|
||||||
) as {{ column_name | replace("At", "") | replace("Date", "") }}_date_utc
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
@ -4,8 +4,14 @@ with
|
||||||
select
|
select
|
||||||
{{ adapter.quote("formId") }} as id_form,
|
{{ adapter.quote("formId") }} as id_form,
|
||||||
{{ adapter.quote("values") }} as "values",
|
{{ adapter.quote("values") }} as "values",
|
||||||
{{ timestamp_to_utc("submittedAt") }},
|
{{ unix_ms_timestamp_to_utc("submittedAt") }} as submitted_at_utc,
|
||||||
{{ timestamp_to_utc("updatedAt") }},
|
cast(
|
||||||
|
{{ unix_ms_timestamp_to_utc("submittedAt") }} as date
|
||||||
|
) as submitted_date_utc,
|
||||||
|
{{ unix_ms_timestamp_to_utc("updatedAt") }} as updated_at_utc,
|
||||||
|
cast(
|
||||||
|
{{ unix_ms_timestamp_to_utc("updatedAt") }} as date
|
||||||
|
) as updated_date_utc,
|
||||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
from raw_form_submissions
|
from raw_form_submissions
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue