diff --git a/.changes/unreleased/Fixes-20230508-044922.yaml b/.changes/unreleased/Fixes-20230508-044922.yaml new file mode 100644 index 00000000000..9847c2224b1 --- /dev/null +++ b/.changes/unreleased/Fixes-20230508-044922.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: enable dbt show for seeds +time: 2023-05-08T04:49:22.82093-07:00 +custom: + Author: aranke + Issue: "7273" diff --git a/core/dbt/task/show.py b/core/dbt/task/show.py index 1b84b85e093..0ea7160bfa7 100644 --- a/core/dbt/task/show.py +++ b/core/dbt/task/show.py @@ -2,12 +2,14 @@ import threading import time +from dbt.contracts.graph.nodes import SeedNode from dbt.contracts.results import RunResult, RunStatus from dbt.events.base_types import EventLevel from dbt.events.functions import fire_event from dbt.events.types import ShowNode, Note from dbt.exceptions import DbtRuntimeError from dbt.task.compile import CompileTask, CompileRunner +from dbt.task.seed import SeedRunner class ShowRunner(CompileRunner): @@ -41,8 +43,11 @@ def _runtime_initialize(self): raise DbtRuntimeError("Either --select or --inline must be passed to show") super()._runtime_initialize() - def get_runner_type(self, _): - return ShowRunner + def get_runner_type(self, node): + if isinstance(node, SeedNode): + return SeedRunner + else: + return ShowRunner def task_end_messages(self, results): is_inline = bool(getattr(self.args, "inline", None)) diff --git a/tests/functional/show/test_show.py b/tests/functional/show/test_show.py index aa5dbb6025c..4cda22935d0 100644 --- a/tests/functional/show/test_show.py +++ b/tests/functional/show/test_show.py @@ -87,6 +87,10 @@ def test_second_ephemeral_model(self, project): ) assert "col_hundo" in log_output + def test_seed(self, project): + (results, log_output) = run_dbt_and_capture(["show", "--select", "sample_seed"]) + assert "Previewing node 'sample_seed'" in log_output + class TestShowModelVersions: @pytest.fixture(scope="class")