From 7290b0ccdc3f2505902b34e3bec4a94e9a92a397 Mon Sep 17 00:00:00 2001 From: Joost Boonzajer Flaes Date: Sun, 11 Oct 2026 10:44:58 +0300 Subject: [PATCH] fix(vertica): make edr_current_timestamp_in_utc return UTC Vertica had no override, so it fell back to dbt's default__current_timestamp_in_utc_backcompat, which is just the session-local current_timestamp. With the CI container on America/Los_Angeles, the "UTC" timestamp lagged real UTC by 7 hours, so between 00:00 and 07:00 UTC freshness SLA deadlines looked unpassed and metric stability baselines looked unsettled, and tests that should fail passed. Use current_timestamp at time zone 'UTC' instead, and note in the compose file that the non-UTC TZ is intentional. Co-Authored-By: Claude Opus 5.5 --- integration_tests/docker-compose-vertica.yml | 2 ++ macros/utils/cross_db_utils/current_timestamp.sql | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/integration_tests/docker-compose-vertica.yml b/integration_tests/docker-compose-vertica.yml index d418d667a..59aded696 100644 --- a/integration_tests/docker-compose-vertica.yml +++ b/integration_tests/docker-compose-vertica.yml @@ -9,6 +9,8 @@ services: VERTICA_SCHEMA: ${SCHEMA_NAME} APP_DB_USER: dbadmin APP_DB_PASSWORD: vertica + # Deliberately not UTC: keeps the suite honest about macros that must + # use UTC rather than the server's local time. TZ: "America/Los_Angeles" VERTICA_DB_NAME: elementary_tests VMART_ETL_SCRIPT: "" diff --git a/macros/utils/cross_db_utils/current_timestamp.sql b/macros/utils/cross_db_utils/current_timestamp.sql index 2525d3668..452841942 100644 --- a/macros/utils/cross_db_utils/current_timestamp.sql +++ b/macros/utils/cross_db_utils/current_timestamp.sql @@ -114,3 +114,9 @@ -- Dremio CURRENT_TIMESTAMP() is always in UTC current_timestamp() {%- endmacro -%} + +{% macro vertica__edr_current_timestamp_in_utc() -%} + {#- dbt's default falls back to the session-local current_timestamp, which + is off by the server's UTC offset whenever Vertica is not set to UTC. -#} + cast(current_timestamp at time zone 'UTC' as timestamp) +{%- endmacro -%}