Skip to content
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

Changes to dispatch in dbt v0.20 #78

Closed
jtcohen6 opened this issue Jun 6, 2021 · 1 comment · Fixed by #82
Closed

Changes to dispatch in dbt v0.20 #78

jtcohen6 opened this issue Jun 6, 2021 · 1 comment · Fixed by #82

Comments

@jtcohen6
Copy link

jtcohen6 commented Jun 6, 2021

Hey Claus! Planning to open this same issue in the dbt-date package momentarily :)

Required code change

We've made a change to adapter.dispatch: Instead of passing a _get_namespaces() macro to the packages arg, you should pass the name of this package (as a string) to the macro_namespace arg, which is now the second positional argument.

In practice, this just looks like switching each macro like:

{% macro log_natural(x) -%}
{{ adapter.dispatch('log_natural', packages=dbt_expectations._get_namespaces()) (x) }}
{% endmacro %}

To:

{% macro log_natural(x) -%}
    {{ adapter.dispatch('log_natural', 'dbt_expectations') (x) }}
{% endmacro %}

I hope this could be as simple as Find + Replace for packages=dbt_expectations._get_namespaces()'dbt_expectations'.

For the README

If a user wishes to override/shim this package, instead of defining a var named dbt_expectations_dispatch_list (or dbt_utils_dispatch_list), they should now define a config in dbt_project.yml, for instance:

dispatch:
  - macro_namespace: dbt_expectations
    search_order: ['my_project', 'dbt_expectations']  # enable override
  - macro_namespace: dbt_utils
    search_order: ['spark_utils', 'dbt_utils']  # shim for spark

Notes

This change is in dbt v0.19.2 as well. Both v0.19.2 and v0.20.0 have backwards compatibility for the old syntax, so there's no huge rush to upgrade. As soon as you do upgrade to the new syntax, you'll need to require dbt >= 0.19.2 (or just >=0.20.0, for simplicity, since you're already making compatibility changes in #69).

See also:

@clausherther
Copy link
Contributor

Hi @jtcohen6, thanks for much for this and the issue in dbt-date and the helpful comments on #61, really appreciate it! It'll take a bit to work through this and plan the 0.19.2/0.20.0 compatible releases, I'll let you know if I have any questions. Thanks again!

@clausherther clausherther pinned this issue Jun 6, 2021
@clausherther clausherther linked a pull request Jun 8, 2021 that will close this issue
@clausherther clausherther unpinned this issue Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants