Open M39913 opened 5 months ago
I was able to run both
{{ dbt_date.get_date_dimension("1990-01-01", "2050-12-31") }}
and
{{ dbt_date.get_base_dates(n_dateparts=7) }}
against BigQuery without issues. We don't really support databricks, so I can't tell you if it has to do with that adapter. We do run integration tests against dbt-spark and run https://github.com/calogica/dbt-date/blob/c596b56da5cb56a60fc65a3230992a647ff22f58/integration_tests/models/dates.sql#L6 and various flavors of https://github.com/calogica/dbt-date/blob/c596b56da5cb56a60fc65a3230992a647ff22f58/integration_tests/models/dim_hour.sql#L7 in our test date models.
Best thing would probably be to get the exact compiled run-time SQL line that's failing.
Thanks for your response! I tried the tests, both of them didn't work, I got the same error.
This is the complete error by the way: Runtime Error Compilation Error in model Datum_tabel (models\scd0\Datum_tabel.sql) int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
> in macro default__get_intervals_between (macros\_utils\date_spine.sql)
> called by macro get_intervals_between (macros\_utils\date_spine.sql)
> called by macro default__date_spine (macros\_utils\date_spine.sql)
> called by macro date_spine (macros\_utils\date_spine.sql)
> called by macro default__get_base_dates (macros\get_base_dates.sql)
> called by macro get_base_dates (macros\get_base_dates.sql)
> called by model Datum_tabel (models\scd0\Datum_tabel.sql)
So I get the error before he compiles.
I think it has to do something with macro default__get_intervals_between
You'll need to find the actual SQL statement that fails, not the dbt macros.
get_intervals_between
just calls dbt.datediff(start_date, end_date, datepart)
but I don't know what dbt translates that to on databricks. You'll want to find what SQL this actually runs on your platform to see why it fails.
{%- call statement('get_intervals_between', fetch_result=True) %}
select {{ dbt.datediff(start_date, end_date, datepart) }}
{%- endcall -%}
I tried a multiple things, see below. But I keep getting this error:
int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
packages:
I also tried previous versions.
The model I runned: {{ dbt_date.get_base_dates(start_date="1960-01-01", end_date="2049-12-31")}}
I also tried changing the model to this: {{ dbt_date.get_base_dates(n_dateparts=7) }}
And this: {{ dbt_date.get_date_dimension("1990-01-01", "2050-12-31") }}
I use databricks version 1.7.0 and dbt version 1.7.7 Please let me know your thoughts and any possible solutions :)