Skip to content

Commit

Permalink
Fix: dbt manifest parsing issue (#18930)
Browse files Browse the repository at this point in the history
  • Loading branch information
SumanMaharana authored Dec 5, 2024
1 parent c941569 commit 113fae6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
# Based on https://schemas.getdbt.com/dbt/catalog/v1.json
REQUIRED_CATALOG_KEYS = ["name", "type", "index"]

REQUIRED_CONSTRAINT_KEYS = [
"type",
"name",
"expression",
"warn_unenforced",
"warn_unsupported",
]

REQUIRED_RESULTS_KEYS = {
"status",
"timing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
)
from metadata.ingestion.source.database.database_service import DataModelLink
from metadata.ingestion.source.database.dbt.constants import (
REQUIRED_CONSTRAINT_KEYS,
REQUIRED_NODE_KEYS,
REQUIRED_RESULTS_KEYS,
)
Expand Down Expand Up @@ -187,6 +188,20 @@ def remove_manifest_non_required_keys(self, manifest_dict: dict):
]
for key in keys_to_delete:
del value[key]
if value.get("columns"):
for col_name, value in value[
"columns"
].items(): # pylint: disable=unused-variable
if value.get("constraints"):
keys_to_delete = [
key
for key in value
if key.lower() not in REQUIRED_CONSTRAINT_KEYS
]
for key in keys_to_delete:
del value[key]
else:
value["constraints"] = None

def remove_run_result_non_required_keys(self, run_results: List[dict]):
"""
Expand Down

0 comments on commit 113fae6

Please sign in to comment.