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

refactor: render relationship test on defining model #183

Merged
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
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## dbt 0.19.0 (Release TBD)
## dbt 0.19.2 (Release TBD)
- Reversed the rendering direction of relationship tests so that the test renders in the model it is defined in ([docs#181](https://github.com/fishtown-analytics/dbt-docs/issues/181), [docs#183](https://github.com/fishtown-analytics/dbt-docs/pull/183))

Contributors:
- [@mascah](https://github.com/mascah) ([docs#181](https://github.com/fishtown-analytics/dbt-docs/issues/181), [docs#183](https://github.com/fishtown-analytics/dbt-docs/pull/183))

## dbt 0.19.0 (January 27, 2021)
- Fixed issue where data tests with tags were not showing up in graph viz ([docs#147](https://github.com/fishtown-analytics/dbt-docs/issues/147), [docs#156](https://github.com/fishtown-analytics/dbt-docs/pull/156))
- Clean up development dependencies and docs, fix package installation issue ([docs#164](https://github.com/fishtown-analytics/dbt-docs/issues/164), [docs#165](https://github.com/fishtown-analytics/dbt-docs/pull/165))

Expand Down
10 changes: 7 additions & 3 deletions src/app/services/project_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ angular
test_info.short = 'U';
test_info.label = 'Unique';
} else if (test.test_metadata.name == 'relationships') {
var rel_model_name = test.refs[1];
var rel_model_name = test.refs[0];
var rel_model = model_names[rel_model_name];
if (rel_model && test.test_metadata.kwargs.field) {
// FKs get extra fields
Expand All @@ -197,7 +197,11 @@ angular
var depends_on = test.depends_on.nodes;
var test_column = test.column_name || test.test_metadata.kwargs.column_name || test.test_metadata.kwargs.arg;
if (depends_on.length && test_column) {
var model = depends_on[0];
if (test.test_metadata.name == 'relationships') {
var model = depends_on[1];
} else {
var model = depends_on[0]
}
var node = project.nodes[model];
var column = _.find(node.columns, function(col, col_name) {
return col_name.toLowerCase() == test_column.toLowerCase();
Expand Down Expand Up @@ -573,7 +577,7 @@ angular
var databases = {};
var tree_nodes = _.filter(nodes, function(node) {
var show = _.get(node, ['docs', 'show'], true);
if (!show) {
if (!show) {
return false;
} else if (_.indexOf(['source', 'snapshot', 'seed'], node.resource_type) != -1) {
return true;
Expand Down