Closed federicojasson closed 4 months ago
The flag dependOnDependencyAssertions
is used to add all assertions dependent on a dependency. This includes custom assertions as well. Circular assertion dependencies just like normal circular dependencies should be handled by users.
To avoid this issue, you can explicitly list the specific assertions you need in the dependency field. This gives you more control and helps prevent circular references."
ref: https://cloud.google.com/dataform/docs/assertions#all-dependency-assertions
The flag
dependOnDependencyAssertions
is used to add all assertions dependent on a dependency. This includes custom assertions as well. Circular assertion dependencies just like normal circular dependencies should be handled by users. To avoid this issue, you can explicitly list the specific assertions you need in the dependency field. This gives you more control and helps prevent circular references."ref: https://cloud.google.com/dataform/docs/assertions#all-dependency-assertions
D'oh 🤦‍♂️
You're right, that custom assertion is also an assertion of table_b
, so it would be added as dependency for table_a
.
I wonder if an assertion should be added as dependency of a table when that table is being validated (i.e. is a dependency for the assertion). Intuitively speaking, custom_assertions
is checking both table_a
and table_b
, so when dependOnDependencyAssertions
is used in table_b
, it could skip assertions that depend on table_b
.
Anyway, I may be ignoring side effects of doing such a thing, so I'm closing this issue. Thanks
This is bug report when using
dependOnDependencyAssertions
.The wrong dependency is being set on certain scenarios, which causes a circular dependency chain:
Reproduction steps
Create 3 definition files:
Table A:
definitions/table_a.sqlx
Table B:
definitions/table_b.sqlx
Custom assertions:
definitions/custom_assertions.sqlx
Summary:
nonNull
assertion.ref("table_a")
) and setsdependOnDependencyAssertions: true
to depend on Table A's assertions.ref("table_a")
&ref("table_b")
).Expected behaviour
table_a
doesn't have dependencies.table_b
depends ontable_a
and its assertions.custom_assertions
depends ontable_a
andtable_b
.Actual behaviour
table_a
doesn't have dependencies.table_b
depends ontable_a
, its assertions andcustom_assertions
(BUG?).custom_assertions
depends ontable_a
andtable_b
.Compilation result
Other attempts
I tried using
${ref({name: "table_a", includeDependentAssertions: true})}
indefinitions/table_b.sql
, instead ofdependOnDependencyAssertions: true
. The same issue occurs.