Skip to content

Commit

Permalink
Always build contract checksum for versioned model
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Jul 5, 2023
1 parent 7fbfd53 commit 434d491
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,11 @@ def build_contract_checksum(self):
# We don't need to construct the checksum if the model does not
# have contract enforced, because it won't be used.
# This needs to be executed after contract config is set

# Should we make this a no-op, if the checksum already exists?
if self.contract.checksum is not None:
pass

if self.contract.enforced is True:
contract_state = ""
# We need to sort the columns so that order doesn't matter
Expand Down
2 changes: 2 additions & 0 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,8 @@ def parse_patch(self, block: TargetBlock[UnparsedModelUpdate], refs: ParserRef)

# Includes alias recomputation
self.patch_node_config(versioned_model_node, versioned_model_patch)
# Need to reapply this here, in the case that 'contract: {enforced: true}' was during config-setting
versioned_model_node.build_contract_checksum()
source_file.append_patch(
versioned_model_patch.yaml_key, versioned_model_node.unique_id
)
Expand Down

0 comments on commit 434d491

Please sign in to comment.