dbt-labs / dbt-utils

Utility functions for dbt projects.
https://hub.getdbt.com/dbt-labs/dbt_utils/latest/
Apache License 2.0
1.35k stars 491 forks source link

[Bug] dbt_utils.date_spine gives Python error #873

Open hazvk opened 7 months ago

hazvk commented 7 months ago

Is this a new bug in dbt-core?

Current Behavior

Running this model and using dbt_utils.date_spine used to work. I now get an error I can't get to the bottom of.

Expected Behavior

Should evaluate and give a table

Steps To Reproduce

With dbt on local machine:

  1. Define model as per below

{{ config( materialized = "view" if target.name not in ['prod'] else 'table' ) }}

WITH date_list AS ( {{ dbt_utils.date_spine( datepart="day", start_date="TO_DATE('01/01/2008', 'dd/mm/yyyy')", end_date="TO_DATE(CONCAT(YEAR(CURRENT_DATE) + 6,'-12-31'))" ) }}

)

SELECT * FROM date_list;


2. Install the following packages

databricks-sdk = "==0.17.0" dbt-databricks = "==1.6.8"


3. Run `dbt build -f`

### Relevant log output

```shell
Snippet

01:09:20  Completed with 1 error and 0 warnings:
01:09:20  
01:09:20    Compilation Error in model dim_date (dbt_demo/models/XXX/datamarts/customer_service/dim_date.sql)
  int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

  > in macro default__get_intervals_between (macros/sql/date_spine.sql)
  > called by macro get_intervals_between (macros/sql/date_spine.sql)
  > called by macro default__date_spine (macros/sql/date_spine.sql)
  > called by macro date_spine (macros/sql/date_spine.sql)
  > called by model dim_date (dbt_demo/models/adventureworks/datamarts/customer_service/dim_date.sql)

Environment

- OS: MacOS 14.3 (23D56) Sonoma
- Python: 3.10.2
- dbt: 1.6.10

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

Using dbt-databricks==1.6.8

Last seen working on Jan 24th. Then another issue came up that I only just resolved, per issue (and hence why I fixed version of databricks-sdk). I haven't tested this functionality until yesterday, which is when I first noticed it was broken.

vymaker commented 5 months ago

Wondering if there is an update on the issue?

SvenRelijveld1995 commented 4 months ago

I run into the same error, also databricks 1.7.0 and dbt-core 1.7.14

alxsbn commented 3 months ago

I got the issue but it's working after upgrade. My versions:

Core:
  - installed: 1.8.2
  - latest:    1.8.2 - Up to date!

Plugins:
  - spark:      1.8.0 - Up to date!
  - databricks: 1.8.1 - Up to date!