-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some dbt_utils macros do not work with Spark SQL #291
Comments
@jtcohen6 I know that dbt utils is outside of core, but do you have any thoughts here on where the core-supported plugins start and end vs things like this? I was under the impression the dbt core --> has plugins and if that was the case, dbt utils would support those core plugins. But maybe that's not true? Or maybe Spark is just behind so this is the first time this has been caught? |
I'm not a spark expert, but I do know that there's a separate spark-utils package that is likely useful here! |
IMO "plugin packages" are definitely the answer here, and Thanks to adapter-based macro dispatching, introduced in v0.18.0, you can install a package that "shims" support for another package's macros. So far, I've created As long as you install both packages, and define a var in vars:
dbt_utils_dispatch_list: ['spark_utils'] Throughout your project, you can call macros such as |
just want to update the note above to v0.20.0 syntax for anyone stumbling across this issue like I did dispatch:
- macro_namespace: dbt_utils
search_order: ['spark_utils', 'dbt_utils'] This is a super cool feature btw! |
And it works even more "out of the box" in v1.2: dbt-labs/dbt-spark#359 Closing this one, which has been open for a while :) |
Describe the bug
It appears that many dbt_utils macros are not supported with Spark SQL due to how a lot of the macros are casting with
::
instead ofcast
Steps to reproduce
Expected results
A model should be created just fine.
Actual results
Screenshots and log output
System information
The contents of your
packages.yml
file:packages:
version: 0.6.2
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
macOS Catalina Version 10.15.7
The output of
python --version
:Python 3.7.6
Additional context
Here is one place where casting is done by
::
instead of cast()https://github.com/fishtown-analytics/dbt-utils/blob/9feaccc327a7409298a2bc362db53c2e597024fa/macros/cross_db_utils/current_timestamp.sql#L6
Are you interested in contributing the fix?
Yes! I am happy to change all the
::
to cast() or provide another solution. I would love to contribute to dbt-utils!The text was updated successfully, but these errors were encountered: