Skip to content

Commit c52acee

Browse files
Fix issue 42 (#43)
* Add IF condition to retrieve relation from deferral * Update description for __get_relation_ref
1 parent 4058875 commit c52acee

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

macros/artifacts/test/utilities/relation/__get_relation_ref.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
database=item.database,
88
schema=item.schema,
99
identifier=item.alias or item.name) %}
10+
11+
{% if relation is none and item.defer_relation %}
12+
{% set relation = adapter.get_relation(
13+
database=item.defer_relation.database,
14+
schema=item.defer_relation.schema,
15+
identifier=item.defer_relation.alias or item.defer_relation.name) %}
16+
{% endif %}
17+
1018
{{ return(relation) }}
1119
{% endfor %}
1220

macros/artifacts/test/utilities/relation/relation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ macros:
99
Get to-relation string only applicable to the relationship test. Otherwise returns empty.
1010
- name: __get_relation_ref
1111
description: |
12-
Find the ref node in `graph` variable and return the relation string if found. Otherwise empty.
12+
Find the ref node in `graph` variable and return the relation string if found. If deferral is used, return the relation string based on the deferred environment. Otherwise empty.
1313
- name: __get_relation_source
1414
description: |
1515
Find the source node in `graph` variable and return the relation string if found. Otherwise empty.

0 commit comments

Comments
 (0)