support cross_db_utils macros with materialize specific macros #2
Comments
Current
dbt v0.18.0 introduced In effect, this enables "shim" packages to extend + override packages such as For example, let's say a
vars:
dbt_utils_dispatch_list: ['spark_utils'] When dbt goes to dispatch For the time being, your best bet here may be to create a {% macro materialize__datediff() %}
{{ return(dbt_utils.postgres__datediff(first_date, second_date, datepart)) }}
{% endmacro %} As long as users install Future
In a world with both of these changes, dbt would dispatch macro implementations in the following order:
|
Thank you for your guidance @jtcohen6! I just created a new Quick question for you - should |
Also for you @jtcohen6 - is there anything on dbt's end that expects our utils package to be named exactly |
You could name it whatever you'd like! |
in dbt_utils, dbt has definitions to translate between the various syntaxes of the various databases - postgres, snowflake, bigquery, etc. so that when moving a defined model from e.g. bigquery to e.g. snowflake, users get the same behavior.
For instance, every database defines
EXCEPT
one way, but bigquery gives you something else if you sayEXCEPT
, and gives you the same behavior when you sayEXCEPT DISINCT
. Therefore,dbt
has a set of macros so that users get the same behavior. These macros are listed here:https://github.com/fishtown-analytics/dbt-utils/tree/master/macros/cross_db_utils
Under except.sql, you will see the pattern match that replaces
except
withexcept distinct
if the database is bigquery.We also need to build a similar set of macros for Materialize. There already are macros for postgres, and it may be that we just need to copy them. Or it may be that we need to do them, plus a few more. It also turns out that we don't need to upstream our behavior to the main repo, we can simply add our own macros in our adapter (I don't know where, but
@jthandy
indicated that there was a place).Assigned to @JLDLaughlin for triage.
The text was updated successfully, but these errors were encountered: