File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
macros/edr/tests/test_utils Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11{% macro get_model_relation_for_test(test_model, test_node) %}
2- {% set depends_on_node_ids = test_node .get (" depends_on" , {}).get(" nodes" ) %}
3- {% if depends_on_node_ids and depends_on_node_ids | length == 1 %}
4- {% set node = elementary .get_node (depends_on_node_ids[0 ]) %}
5- {% do return(elementary .get_relation_from_node (node)) %}
6- {% endif %}
7-
82 {# If the test model is not a string, then return as-is #}
93 {% if test_model is not string %}
104 {% do return(test_model) %}
115 {% endif %}
126
7+ {# If the test depends on a single model ID, try to get the relation from it #}
8+ {% set depends_on_node_ids = test_node .get (" depends_on" , {}).get(" nodes" ) %}
9+ {% if depends_on_node_ids and depends_on_node_ids | length == 1 %}
10+ {% set node = elementary .get_node (depends_on_node_ids[0 ]) %}
11+ {% set relation = elementary .get_relation_from_node (node) %}
12+ {% if relation %}
13+ {% do return(relation) %}
14+ {% endif %}
15+ {% endif %}
16+
1317 {# Test model is a string, this might mean that a "where" parameter was passed to the test.
1418 In the heuristic below we rely on the fact that in this case the model jinja will have
1519 a very specific structure (see the " build_model_str" function in dbt- core) # }
You can’t perform that action at this time.
0 commit comments