From 0f762b9a9e43bf4a680f17597cc115143dbc8cd5 Mon Sep 17 00:00:00 2001 From: Chenyu Li Date: Thu, 12 Dec 2024 13:40:18 -0800 Subject: [PATCH] not writting batch and _event_status --- core/dbt/contracts/graph/nodes.py | 8 + schemas/dbt/manifest/v12.json | 188 ++++++++++++++++--- tests/functional/artifacts/test_artifacts.py | 2 + tests/unit/utils/__init__.py | 2 +- 4 files changed, 168 insertions(+), 32 deletions(-) diff --git a/core/dbt/contracts/graph/nodes.py b/core/dbt/contracts/graph/nodes.py index 8fc39c7621b..a7f0af5b1a5 100644 --- a/core/dbt/contracts/graph/nodes.py +++ b/core/dbt/contracts/graph/nodes.py @@ -475,6 +475,8 @@ def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None): del dct["_has_this"] if "previous_batch_results" in dct: del dct["previous_batch_results"] + if "batch" in dct: + del dct["batch"] return dct @classmethod @@ -1371,6 +1373,12 @@ def search_name(self): def group(self): return None + def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None): + dct = super().__post_serialize__(dct, context) + if "_event_status" in dct: + del dct["_event_status"] + return dct + # ==================================== # Exposure node diff --git a/schemas/dbt/manifest/v12.json b/schemas/dbt/manifest/v12.json index 5e9198b07f6..4ee1b3545a7 100644 --- a/schemas/dbt/manifest/v12.json +++ b/schemas/dbt/manifest/v12.json @@ -13,7 +13,7 @@ }, "dbt_version": { "type": "string", - "default": "1.9.0b4" + "default": "1.10.0a1" }, "generated_at": { "type": "string" @@ -4205,6 +4205,12 @@ }, "additionalProperties": false }, + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "access": { "enum": [ "private", @@ -4779,7 +4785,7 @@ "default": null } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "database", "schema", @@ -7690,6 +7696,12 @@ "identifier": { "type": "string" }, + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "quoting": { "type": "object", "title": "Quoting", @@ -8223,7 +8235,7 @@ "default": null } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "database", "schema", @@ -9121,19 +9133,7 @@ "type": "integer" }, "granularity": { - "enum": [ - "nanosecond", - "microsecond", - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "quarter", - "year" - ] + "type": "string" } }, "additionalProperties": false, @@ -14014,6 +14014,12 @@ }, "additionalProperties": false }, + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "access": { "enum": [ "private", @@ -14588,7 +14594,7 @@ "default": null } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "database", "schema", @@ -17490,6 +17496,12 @@ "identifier": { "type": "string" }, + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "quoting": { "type": "object", "title": "Quoting", @@ -18023,7 +18035,7 @@ "default": null } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "database", "schema", @@ -18712,19 +18724,7 @@ "type": "integer" }, "granularity": { - "enum": [ - "nanosecond", - "microsecond", - "millisecond", - "second", - "minute", - "hour", - "day", - "week", - "month", - "quarter", - "year" - ] + "type": "string" } }, "additionalProperties": false, @@ -20024,6 +20024,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, @@ -20178,6 +20199,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, @@ -20341,6 +20383,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, @@ -21586,6 +21649,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, @@ -21740,6 +21824,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, @@ -21903,6 +22008,27 @@ } ], "default": null + }, + "config": { + "anyOf": [ + { + "type": "object", + "title": "SemanticLayerElementConfig", + "properties": { + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, diff --git a/tests/functional/artifacts/test_artifacts.py b/tests/functional/artifacts/test_artifacts.py index 92ec8abe196..1927edea06c 100644 --- a/tests/functional/artifacts/test_artifacts.py +++ b/tests/functional/artifacts/test_artifacts.py @@ -503,6 +503,8 @@ def verify_manifest(project, expected_manifest, start_time, manifest_schema_path elif key in ["nodes", "sources", "exposures", "metrics", "disabled", "docs"]: for unique_id, node in expected_manifest[key].items(): assert unique_id in manifest[key] + # if "_event_status" in manifest[key][unique_id]: + # del manifest[key][unique_id]["_event_status"] assert manifest[key][unique_id] == node, f"{unique_id} did not match" else: # ['docs', 'parent_map', 'child_map', 'group_map', 'selectors', 'semantic_models', 'saved_queries'] assert manifest[key] == expected_manifest[key] diff --git a/tests/unit/utils/__init__.py b/tests/unit/utils/__init__.py index 6669bad45c9..01b980b96d2 100644 --- a/tests/unit/utils/__init__.py +++ b/tests/unit/utils/__init__.py @@ -201,7 +201,7 @@ def assert_from_dict(obj, dct, cls=None): if hasattr(obj, "created_at"): obj_from_dict.created_at = 1 obj.created_at = 1 - if "_event_status" in obj.extra: + if hasattr(obj, "extra") and "_event_status" in obj.extra: obj.extra["_event_status"] = None obj_from_dict.extra["_event_status"] = None assert obj_from_dict == obj