Skip to content

Commit

Permalink
Use timestamp sub for less than condition
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Sep 5, 2024
1 parent c344bcf commit b7dd754
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/intermediate/trades/int_trade_agg_day.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ with
, buying_amount
from {{ ref('stg_history_trades') }}
where
ledger_closed_at < TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
ledger_closed_at < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
and ledger_closed_at >= '{{ dbt_airflow_macros.ts(timezone=none) }}'
)

Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/trades/int_trade_agg_month.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ with
, buying_amount
from {{ ref('stg_history_trades') }}
where
ledger_closed_at < TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
ledger_closed_at < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
and ledger_closed_at >= TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 31 DAY )
)

Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/trades/int_trade_agg_week.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ with
, buying_amount
from {{ ref('stg_history_trades') }}
where
ledger_closed_at < TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
ledger_closed_at < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
and ledger_closed_at >= TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 8 DAY )
)

Expand Down
2 changes: 1 addition & 1 deletion models/intermediate/trades/int_trade_agg_year.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ with
, buying_amount
from {{ ref('stg_history_trades') }}
where
ledger_closed_at < TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
ledger_closed_at < TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 DAY )
and ledger_closed_at >= TIMESTAMP_ADD('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 366 DAY )
)

Expand Down

0 comments on commit b7dd754

Please sign in to comment.