Skip to content

Commit

Permalink
remove extra when serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenyuLInx committed Dec 12, 2024
1 parent 5b36ec7 commit 7acd049
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions core/dbt/artifacts/resources/v1/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@ def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None):
dct = super().__post_serialize__(dct, context)
if context and context.get("artifact") and "defer_relation" in dct:
del dct["defer_relation"]

# delete extra keys that should't be serialized
if self.extra:
for key, _ in self.extra.items():
if key in dct:
del dct[key]
return dct
1 change: 0 additions & 1 deletion core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,6 @@ def writable_manifest(self) -> "WritableManifest":
self.build_parent_and_child_maps()
self.build_group_map()
self.fill_tracking_metadata()

return WritableManifest(
nodes=self._map_nodes_to_map_resources(self.nodes),
sources=self._map_nodes_to_map_resources(self.sources),
Expand Down
2 changes: 0 additions & 2 deletions core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,6 @@ 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
Expand Down
1 change: 1 addition & 0 deletions tests/unit/contracts/graph/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"deprecation_date",
"defer_relation",
"time_spine",
"batch",
}
)

Expand Down

0 comments on commit 7acd049

Please sign in to comment.