Recently, upgraded my dbt to v1.3 and facing some issues with a few macros but a new compilation error keeps coming for datediff or datespine , which is not working out
Error message:
09:29:41 Compilation Error in model android_track_sessionized
09:29:41 'dict object' has no attribute 'datediff'. This can happen when calling a macro that does not exist. Check for typos and/or install package dependencies with "dbt deps".
– Same error shows up for datespine too, when changed
The context of why I’m trying to do this
I’m trying to fix this so that my sessionization code works out
Source: segment/segment_web_page_views__sessionized.sql at main · dbt-labs/segment · GitHub
My packages look like this :
packages:
- package: dbt-labs/dbt_utils
version: “1.0.0”
What I’ve already tried
Tested a few new macros like datespine, but the same error shows up. Also the macro does exist in dbt-utils too - so not sure what’s causing it.
Code part that causes errors: -
diffed AS (
--calculates `period_of_inactivity`.
SELECT
*,
{{ dbt_utils.datediff(
'previous_tstamp',
'timestamp',
'second'
) }} AS period_of_inactivity
FROM
lagged
Would appreciate any directional help here, curious if I should upgrade to v1.4 dbt or add a new macro definition