From 031ee4046da9a4278606a5122ea2647293b1c179 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Tue, 5 Oct 2021 09:05:23 -0500 Subject: [PATCH] =?UTF-8?q?enacted=20deprecation=20for=20dispatch-packages?= =?UTF-8?q?,=20cleaned=20up=20deprecations=20te=E2=80=A6=20(#3975)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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: 3caec08ccb8607484ce96a3522be002c4cdd6e58 --- core/dbt/clients/jinja_static.py | 2 +- core/dbt/context/providers.py | 4 ++-- core/dbt/exceptions.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/dbt/clients/jinja_static.py b/core/dbt/clients/jinja_static.py index 348cfe4d3d6..3d37cbd413b 100644 --- a/core/dbt/clients/jinja_static.py +++ b/core/dbt/clients/jinja_static.py @@ -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 diff --git a/core/dbt/context/providers.py b/core/dbt/context/providers.py index e083ac90365..4748e5d2ece 100644 --- a/core/dbt/context/providers.py +++ b/core/dbt/context/providers.py @@ -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 ' @@ -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.' ) diff --git a/core/dbt/exceptions.py b/core/dbt/exceptions.py index 9763f269a40..9158939be1c 100644 --- a/core/dbt/exceptions.py +++ b/core/dbt/exceptions.py @@ -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. @@ -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))