Yes, model takes var('current_date') and generate model with it. No problem with variable from dbt_project.yml.
CLI works also like: dbt run --select +model --vars '{"key": "value", "current_date": "2023-03-13"}'
But how instead of '2023-03-13 'get dynamic variable of today date in CLI?
Oh, really! It worked :slight_smile
But now if run simple dbt run --select model
got error No matching signature for operator <= for argument types: DATE, INT64. Supported signature: ANY <= ANY
But probably it’s another topic.
with payouts as (
-- config
with payouts as (
select
*
from table_a
where transaction_date <= 2022-12-31
group by
column_b
)
select * from payouts
)
select * from payouts
I am misisng quotes ‘’ to compile correctly, but with current_date() works fine.
I look up current date from date dimension.
If you use a function like getdate(), you wont get benefits of cached results. Which is important for me to keep costs down.