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