-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a no-op exposure runner (#11082)
- Loading branch information
Showing
19 changed files
with
153 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Create a no-op exposure runner | ||
time: 2024-12-02T16:47:15.766574Z | ||
custom: | ||
Author: aranke | ||
Issue: ' ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .exposure_runner import ExposureRunner | ||
from .saved_query_runner import SavedQueryRunner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from dbt.runners.no_op_runner import NoOpRunner | ||
|
||
|
||
class ExposureRunner(NoOpRunner): | ||
@property | ||
def description(self) -> str: | ||
return f"exposure {self.node.name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import threading | ||
|
||
from dbt.artifacts.schemas.results import RunStatus | ||
from dbt.artifacts.schemas.run import RunResult | ||
from dbt.contracts.graph.manifest import Manifest | ||
from dbt.events.types import LogNodeNoOpResult | ||
from dbt.task.base import BaseRunner | ||
from dbt_common.events.functions import fire_event | ||
|
||
|
||
class NoOpRunner(BaseRunner): | ||
@property | ||
def description(self) -> str: | ||
raise NotImplementedError("description not implemented") | ||
|
||
def before_execute(self) -> None: | ||
pass | ||
|
||
def compile(self, manifest: Manifest): | ||
return self.node | ||
|
||
def after_execute(self, result) -> None: | ||
fire_event( | ||
LogNodeNoOpResult( | ||
description=self.description, | ||
index=self.node_index, | ||
total=self.num_nodes, | ||
node_info=self.node.node_info, | ||
) | ||
) | ||
|
||
def execute(self, compiled_node, manifest): | ||
# no-op | ||
return RunResult( | ||
node=compiled_node, | ||
status=RunStatus.NoOp, | ||
timing=[], | ||
thread_id=threading.current_thread().name, | ||
execution_time=0, | ||
message="NO-OP", | ||
adapter_response={}, | ||
failures=0, | ||
batch_results=None, | ||
agate_table=None, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from dbt.runners.no_op_runner import NoOpRunner | ||
|
||
|
||
class SavedQueryRunner(NoOpRunner): | ||
@property | ||
def description(self) -> str: | ||
return f"saved query {self.node.name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.