Commit 8e1fc0b
fix: handle dbt deferral in get_elementary_relation (#1006)
* fix: handle dbt deferral in get_elementary_relation
When --favor-state or --defer is active, Elementary models may not be
built in the CI target schema. adapter.get_relation() returns None in
this case, causing anomaly tests to fail with 'relation "none" does
not exist'.
Fall back to constructing a Relation from graph node coordinates when
the physical catalog lookup returns None but the node exists in the
dbt graph. This allows the generated SQL to reference the correct
(deferred) schema.
Co-Authored-By: Noy Arie <noyarie1992@gmail.com>
* fix: gate deferral fallback on --defer/--favor-state flags
Only construct a synthetic Relation when dbt deferral is actually
active (invocation_args_dict.defer or favor_state). Without this
guard, the fallback would fire for any installed Elementary model
whose table doesn't exist yet (e.g. partial dbt run), breaking
callers that rely on a None return to detect missing tables.
Co-Authored-By: Noy Arie <noyarie1992@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 91d04fd commit 8e1fc0b
1 file changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
| 38 | + | |
| 39 | + | |
27 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
28 | 50 | | |
29 | 51 | | |
0 commit comments