When Dataform was first released as General Availability, built-in assertions (uniqueKey, nonNull,…) were actually run in a workflow as dependencies to whatever table they were attached to and run before the table was built.
At some point in the recent past this was changed and built-in assertions are now run as dependents, after the table is built.
This is all fine but I’m wondering if it’s possible to use the built-in assertions as dependencies that run prior to building the table they are attached to?
I understand that I can make a manual assertion that mimics the built-in assertions functionality. I’m just curious if there’s a simpler way.
Standard config block with assertions as dependents.
config { type: "table",
name: "my_table",
schema: "my_schema",
description: "",
bigquery: {
labels: {
scheduler: "dataform"
}
},
dependencies: [
"total_vol_drop_assertion",
"units_drop_assertion",
],
assertions: {
uniqueKey: ["id"],
nonNull:["id"]
}
}
To something like this…
config { type: "table",
name: "my_table",
schema: "my_schema",
description: "",
bigquery: {
labels: {
scheduler: "dataform"
}
},
dependencies: [uniqueKey: ["id"],
nonNull:["id"],
"total_vol_drop",
"units_drop",
],
}
}
The documentation has the below example but it’s not descriptive enough for me to work with.
The following code sample shows table A assertions added as dependencies to table B:
config {
type: "table",
dependencies: [ "A_uniqueKey", "A_nonNull"]
}