diff --git a/core/dbt/events/core_types.proto b/core/dbt/events/core_types.proto index 2938ebb554f..1738b4e652f 100644 --- a/core/dbt/events/core_types.proto +++ b/core/dbt/events/core_types.proto @@ -1690,6 +1690,35 @@ message MicrobatchExecutionDebugMsg { MicrobatchExecutionDebug data = 2; } +// Q045 +message LogBatchLine { + NodeInfo node_info = 1; + string description = 2; + int32 batch_index = 3; + int32 total_batches = 4; +} + +message LogStartBatchMsg { + CoreEventInfo info = 1; + LogBatchLine data = 2; +} + +// Q046 +message LogBatchResult { + NodeInfo node_info = 1; + string description = 2; + string status = 3; + int32 batch_index = 4; + int32 total_batches = 5; + float execution_time = 6; + Group group = 7; +} + +message LogBatchResultMsg { + CoreEventInfo info = 1; + LogBatchResult data = 2; +} + // W - Node testing // Skipped W001 diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py index 85d2df355ae..9e24f67389d 100644 --- a/core/dbt/events/types.py +++ b/core/dbt/events/types.py @@ -1710,6 +1710,47 @@ def message(self) -> str: return self.msg +class LogStartBatch(InfoLevel): + def code(self) -> str: + return "Q045" + + def message(self) -> str: + msg = f"START {self.description}" + return format_fancy_output_line( + msg=msg, + status="RUN", + index=self.batch_index, + total=self.total_batches, + progress_prefix="Batch", + ) + + +class LogBatchResult(DynamicLevel): + def code(self) -> str: + return "Q046" + + def message(self) -> str: + if self.status == "error": + info = "ERROR creating" + status = red(self.status.upper()) + elif "SKIP" in self.status: + info = "SKIPPED" + status = yellow(self.status.upper()) + else: + info = "OK created" + status = green(self.status) + + msg = f"{info} {self.description}" + return format_fancy_output_line( + msg=msg, + status=status, + index=self.batch_index, + total=self.total_batches, + execution_time=self.execution_time, + progress_prefix="Batch", + ) + + # ======================================================= # W - Node testing # =======================================================