Skip to content

Commit

Permalink
Add parser for source also
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed Jan 21, 2025
1 parent bba9253 commit d2cbb68
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions core/dbt/artifacts/resources/v1/source_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ class SourceDefinition(ParsedSourceMandatory):
created_at: float = field(default_factory=lambda: time.time())
unrendered_database: Optional[str] = None
unrendered_schema: Optional[str] = None
doc_blocks: List[List[str]] = field(default_factory=list)
18 changes: 9 additions & 9 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1714,17 +1714,17 @@ def _process_docs_for_source(
context: Dict[str, Any],
source: SourceDefinition,
):
table_description = source.description
source_description = source.source_description
table_description = get_rendered(table_description, context)
source_description = get_rendered(source_description, context)
source.description = table_description
source.source_description = source_description
source.description, source.doc_blocks = _get_description_and_doc_blocks(
source.description, context
)
source.source_description, source.doc_blocks = _get_description_and_doc_blocks(
source.source_description, context
)

for column in source.columns.values():
column_desc = column.description
column_desc = get_rendered(column_desc, context)
column.description = column_desc
column.description, column.doc_blocks = _get_description_and_doc_blocks(
column.description, context
)


# macro argument descriptions
Expand Down
18 changes: 18 additions & 0 deletions schemas/dbt/manifest/v12.json
Original file line number Diff line number Diff line change
Expand Up @@ -8426,6 +8426,15 @@
}
],
"default": null
},
"doc_blocks": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -18431,6 +18440,15 @@
}
],
"default": null
},
"doc_blocks": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/artifacts/expected_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ def expected_references_manifest(project):
"tags": [],
"constraints": [],
"granularity": None,
"doc_blocks": [],
"doc_blocks": [["doc", "column_info"]],
}
},
"config": {
Expand Down

0 comments on commit d2cbb68

Please sign in to comment.