Skip to content

Commit

Permalink
fix #7273: enable dbt show for seeds (#7544)
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke authored May 8, 2023
1 parent 40aca4b commit 881437e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230508-044922.yaml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 7 additions & 2 deletions core/dbt/task/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/show/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 881437e

Please sign in to comment.