Skip to content

Commit

Permalink
(#1619) fix for unrendered source column descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Jul 26, 2019
1 parent b12484b commit 291ef56
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions core/dbt/parser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ def process_docs_for_source(cls, manifest, current_project, source):
source.set('description', table_description)
source.set('source_description', source_description)

for column_name, column_def in source.columns.items():
column_description = column_def.get('description', '')
column_description = dbt.clients.jinja.get_rendered(
column_description, context)
column_def['description'] = column_description

@classmethod
def process_docs(cls, manifest, current_project):
for node in manifest.nodes.values():
Expand Down
4 changes: 4 additions & 0 deletions test/integration/029_docs_generate_tests/ref_models/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ My source
{% docs table_info %}
My table
{% enddocs %}

{% docs column_info %}
An ID field
{% enddocs %}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ sources:
identifier: True
columns:
- name: id
description: "An ID field"
description: "{{ doc('column_info') }}"
16 changes: 16 additions & 0 deletions test/integration/029_docs_generate_tests/test_docs_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,11 @@ def expected_postgres_references_manifest(self, model_database=None):
'database': self.default_database,
'description': 'My table',
'docrefs': [
{
"documentation_package": "",
"documentation_name": "column_info",
"column_name": "id",
},
{
'documentation_name': 'table_info',
'documentation_package': ''
Expand Down Expand Up @@ -1294,6 +1299,17 @@ def expected_postgres_references_manifest(self, model_database=None):
},
'docs': {
'dbt.__overview__': ANY,
"test.column_info": {
"block_contents": "An ID field",
"file_contents": docs_file,
"name": "column_info",
"original_file_path": docs_path,
"package_name": "test",
"path": "docs.md",
"resource_type": "docs",
"root_path": OneOf(self.test_root_dir, self.initial_dir),
"unique_id": "test.column_info",
},
'test.ephemeral_summary': {
'block_contents': (
'A summmary table of the ephemeral copy of the seed data'
Expand Down

0 comments on commit 291ef56

Please sign in to comment.