From 7c118f77fd59fe4af937235815e0f4f68200f94e Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Mon, 25 Sep 2023 13:30:08 +0100 Subject: [PATCH] rename show macro, pass kwargs explicitly --- core/dbt/include/global_project/macros/adapters/show.sql | 4 ++-- core/dbt/task/show.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/dbt/include/global_project/macros/adapters/show.sql b/core/dbt/include/global_project/macros/adapters/show.sql index 2ff97dd68fe..d71aa3a7572 100644 --- a/core/dbt/include/global_project/macros/adapters/show.sql +++ b/core/dbt/include/global_project/macros/adapters/show.sql @@ -1,5 +1,5 @@ -{% macro show(limit) -%} - {%- set sql_header = config.get('sql_header', none) -%} +{% macro get_show_sql(compiled_code, sql_header, limit) -%} + {%- set sql_header = sql_header -%} {{ sql_header if sql_header is not none }} {%- if limit is not none -%} {{ get_limit_subquery_sql(compiled_code, limit) }} diff --git a/core/dbt/task/show.py b/core/dbt/task/show.py index 439246340b8..eba7dc663c6 100644 --- a/core/dbt/task/show.py +++ b/core/dbt/task/show.py @@ -26,10 +26,14 @@ def execute(self, compiled_node, manifest): model_context = generate_runtime_model_context(compiled_node, self.config, manifest) compiled_node.compiled_code = self.adapter.execute_macro( - macro_name="show", + macro_name="get_show_sql", manifest=manifest, context_override=model_context, - kwargs={"limit": limit}, + kwargs={ + "compiled_code": model_context["compiled_code"], + "sql_header": model_context["config"].get("sql_header"), + "limit": limit, + }, ) adapter_response, execute_result = self.adapter.execute( compiled_node.compiled_code, fetch=True