Using SQL to set var in Project.yml

The problem I’m having

How do I set a variable (usedate) in project.yml using SQL? I need that variable to be the last day of the month based on the system date.

When dbt run is executed, the default will be what is in project.yml. If the var needs to be another date, then it would need to be set at dbt run command.

project.yml

image

model code snippet:

dbt run error: ( not using --vars)

image

in Project.yml, I also tried:

image

I would try removing the double quotes

Something like

... TO_DATE({{ var('usedate') }}) ...

instead of

... TO_DATE("{{ var('usedate') }}") ...

Thank you . After much analysis, it was my model sql that needed to be adjusted.