Feature: Specify date-type (today timestamp only?)
christopherekfeldt opened this issue · 1 comments
christopherekfeldt commented
Is this a new bug in dbt-date?
- I believe this is a new bug in dbt-date
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
I want to use "n_months_ago" macro to validate tests in dbt for a field that isn't older than 27 months. The field is based on the datatype "date" in BigQuery. This macro generated a timestamp.
Expected Behavior
It would be cool if you could select what date-type it is. Like: timestamp, date, datetime, int-range etc.
I can solve the issue today by doing :
cast({{ dbt_date.n_months_ago(27) }} as date)
but it isn't pretty.
Environment
- OS: Ubuntu 20.04
- Python: 3.8
- dbt: 1.6
- dbt-expectations: 0.9.0
Which database adapter are you using with dbt?
Note: dbt-date currently does not support database adapters other than the ones listed below.
- Postgres
- Snowflake
- BigQuery
Additional Context
christopherekfeldt commented
Skipped using dbt-date and went with this instead: DATE_SUB(CURRENT_DATE(), INTERVAL 27 MONTH)