From 11504ae5ff18f5461163dd1a611ce2992e428629 Mon Sep 17 00:00:00 2001 From: winnie <91998347+gwenwindflower@users.noreply.github.com> Date: Wed, 27 Mar 2024 13:56:53 -0500 Subject: [PATCH] Fixed date trunc limiting var for Snowflake which broke when fixing for BQ (#18) Testing CI jobs, we want both BQ and SF to run here. --------- Co-authored-by: Winnie Winship Co-authored-by: dave-connors-3 <73915542+dave-connors-3@users.noreply.github.com> --- dbt_project.yml | 2 +- models/marts/order_items.sql | 2 ++ models/staging/stg_locations.sql | 3 --- models/staging/stg_orders.sql | 3 --- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index db8bb68d..0d8039b3 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -20,7 +20,7 @@ clean-targets: - "dbt_packages" vars: - truncate_timespan_to: "cast({{ dbt_date.now() }} as datetime)" + truncate_timespan_to: "{{ dbt.cast(dbt.current_timestamp(), 'datetime') }}" "dbt_date:time_zone": "America/Los_Angeles" seeds: diff --git a/models/marts/order_items.sql b/models/marts/order_items.sql index 924ddfac..efaadfb2 100644 --- a/models/marts/order_items.sql +++ b/models/marts/order_items.sql @@ -10,6 +10,7 @@ order_items as ( orders as ( select * from {{ ref('stg_orders') }} + ), products as ( @@ -33,6 +34,7 @@ order_supplies_summary as ( from supplies group by 1 + ), joined as ( diff --git a/models/staging/stg_locations.sql b/models/staging/stg_locations.sql index 7c49f195..551e1ba2 100644 --- a/models/staging/stg_locations.sql +++ b/models/staging/stg_locations.sql @@ -4,9 +4,6 @@ source as ( select * from {{ source('ecom', 'raw_stores') }} - -- if you generate a larger dataset, - -- you can limit the timespan to the current time with the following line - -- where ordered_at <= {{ var('truncate_timespan_to') }} ), renamed as ( diff --git a/models/staging/stg_orders.sql b/models/staging/stg_orders.sql index 28532b0b..f742c904 100644 --- a/models/staging/stg_orders.sql +++ b/models/staging/stg_orders.sql @@ -3,9 +3,6 @@ with source as ( select * from {{ source('ecom', 'raw_orders') }} - -- if you generate a larger dataset, - -- you can limit the timespan to the current time with the following line - where ordered_at <= {{ var('truncate_timespan_to') }} ),