Skip to content

Commit

Permalink
enacted deprecation for dispatch-packages, cleaned up deprecations te… (
Browse files Browse the repository at this point in the history
#3975)

* enacted deprecation for dispatch-packages, cleaned up deprecations tests for unused macros/models. still need to clean up unused code.

* more work to catch packages use

* fixed tests for removing packages on adapter.dispatch.

* cleaned out folder for 012_deprecation_tests to remove unused models/data/macros

* removed obsolete code due to patching for packages arg in adapter.dispatch

* updated exception name

* added deprecation change to changelog.

automatic commit by git-black, original commits:
  3caec08
  • Loading branch information
emmyoop authored and iknox-fa committed Feb 8, 2022
1 parent d6c6f23 commit 031ee40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/dbt/clients/jinja_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def statically_parse_adapter_dispatch(func_call, ctx, db_wrapper):
# keyword arguments
if func_call.kwargs:
for kwarg in func_call.kwargs:
if kwarg.key == 'macro_name':
if kwarg.key == "macro_name":
# This will remain to enable static resolution
if type(kwarg.value).__name__ == "Const":
func_name = kwarg.value.value
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/context/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def dispatch(
search_packages: List[Optional[str]]

if '.' in macro_name:
suggest_macro_namespace, suggest_macro_name = macro_name.split('.', 1)
suggest_macro_namespace, suggest_macro_name = macro_name.split(".", 1)
msg = (
f'In adapter.dispatch, got a macro name of "{macro_name}", '
f'but "." is not a valid macro name component. Did you mean '
Expand All @@ -152,7 +152,7 @@ def dispatch(
else:
# Not a string and not None so must be a list
raise CompilationException(
f'In adapter.dispatch, got a list macro_namespace argument '
f"In adapter.dispatch, got a list macro_namespace argument "
f'("{macro_namespace}"), but macro_namespace should be None or a string.'
)

Expand Down
4 changes: 2 additions & 2 deletions core/dbt/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def macro_not_found(model, target_macro_id):


def macro_invalid_dispatch_arg(macro_name) -> NoReturn:
msg = '''\
msg = """\
The "packages" argument of adapter.dispatch() has been deprecated.
Use the "macro_namespace" argument instead.
Expand All @@ -683,7 +683,7 @@ def macro_invalid_dispatch_arg(macro_name) -> NoReturn:
For more information, see:
https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch
'''
"""
raise_compiler_error(msg.format(macro_name))


Expand Down

0 comments on commit 031ee40

Please sign in to comment.