Skip to content

Commit

Permalink
Add is_closed column in the orders table
Browse files Browse the repository at this point in the history
Signed-off-by: popcorny <[email protected]>
  • Loading branch information
popcornylu committed Jan 6, 2025
1 parent 8d75fcf commit 1507595
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions models/orders.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ final as (
orders.customer_id,
orders.order_date,
orders.status,
orders.is_closed,

{% for payment_method in payment_methods -%}

Expand Down
10 changes: 7 additions & 3 deletions models/staging/stg_orders.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ renamed as (
select
id as order_id,
user_id as customer_id,
order_date,
status

order_date,
status,
case
when status IN ('completed', 'returned') THEN true
when status IN ('shipped', 'placed', 'return_pending') THEN false
else NULL
end as is_closed
from source

)
Expand Down

0 comments on commit 1507595

Please sign in to comment.