Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for unrendered source column descriptions #1633

Merged
merged 2 commits into from
Jul 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/dbt/parser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ 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_desc = column_def.get('description', '')
column_desc = dbt.clients.jinja.get_rendered(column_desc, context)
column_def['description'] = column_desc

@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