From 32ee4bce615931edf63146d7480ebc6dc9110d79 Mon Sep 17 00:00:00 2001 From: Peter Allen Webb Date: Mon, 21 Oct 2024 18:24:25 -0400 Subject: [PATCH 1/3] Loosen type of TimingInfo.name to improve compatability with older artifact versions. --- core/dbt/artifacts/schemas/results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dbt/artifacts/schemas/results.py b/core/dbt/artifacts/schemas/results.py index ee27fc6d5d4..77405ced3b2 100644 --- a/core/dbt/artifacts/schemas/results.py +++ b/core/dbt/artifacts/schemas/results.py @@ -16,7 +16,7 @@ class TimingInfo(dbtClassMixin): Do not call directly, use `collect_timing_info` instead. """ - name: Literal["compile", "execute", "other"] + name: str started_at: Optional[datetime] = None completed_at: Optional[datetime] = None From 8056895e8f26c1aa8fe14578680fbf6b723f61c4 Mon Sep 17 00:00:00 2001 From: Peter Allen Webb Date: Mon, 21 Oct 2024 18:29:25 -0400 Subject: [PATCH 2/3] One more typing tweak --- core/dbt/artifacts/schemas/results.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/dbt/artifacts/schemas/results.py b/core/dbt/artifacts/schemas/results.py index 77405ced3b2..dd455f309b8 100644 --- a/core/dbt/artifacts/schemas/results.py +++ b/core/dbt/artifacts/schemas/results.py @@ -1,6 +1,6 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Union from dbt.contracts.graph.nodes import ResultNode from dbt_common.dataclass_schema import StrEnum, dbtClassMixin @@ -37,9 +37,7 @@ def to_msg_dict(self): # This is a context manager class collect_timing_info: - def __init__( - self, name: Literal["compile", "execute", "other"], callback: Callable[[TimingInfo], None] - ) -> None: + def __init__(self, name: str, callback: Callable[[TimingInfo], None]) -> None: self.timing_info = TimingInfo(name=name) self.callback = callback From 67f9b8af3f3aa2c6e0152723bd72d5e0a7c87a6e Mon Sep 17 00:00:00 2001 From: Peter Allen Webb Date: Mon, 21 Oct 2024 18:40:02 -0400 Subject: [PATCH 3/3] Restore previous more loosely typed values in TimingInfo.name --- schemas/dbt/run-results/v6.json | 6 +----- schemas/dbt/sources/v3.json | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/schemas/dbt/run-results/v6.json b/schemas/dbt/run-results/v6.json index 96456882ae6..1bf1cf75e83 100644 --- a/schemas/dbt/run-results/v6.json +++ b/schemas/dbt/run-results/v6.json @@ -84,11 +84,7 @@ "title": "TimingInfo", "properties": { "name": { - "enum": [ - "compile", - "execute", - "other" - ] + "type": "string" }, "started_at": { "anyOf": [ diff --git a/schemas/dbt/sources/v3.json b/schemas/dbt/sources/v3.json index 8cb3633f99a..df2784f1a81 100644 --- a/schemas/dbt/sources/v3.json +++ b/schemas/dbt/sources/v3.json @@ -211,11 +211,7 @@ "title": "TimingInfo", "properties": { "name": { - "enum": [ - "compile", - "execute", - "other" - ] + "type": "string" }, "started_at": { "anyOf": [