prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Deterministic checksum calculation for block schemas

Open desertaxle opened this issue 2 years ago • 1 comments

First check

  • [X] I added a descriptive title to this issue.
  • [X] I used the GitHub search to find a similar request and didn't find it.
  • [X] I searched the Prefect documentation for this feature.

Prefect Version

2.x

Describe the proposed behavior

Enforce deterministic ordering of keys and and objects in arrays before computing the checksum on a block schema. This functionality can be added to Block._calculate_schema_checksum().

Describe the current behavior

Currently, block schema computation is sensitive to the order of keys and objects in arrays. This can make it difficult to deterministically calculate the checksum for a block schema when the block schema has been deconstructed and reconstructed later on.

Example Use

No response

Additional context

This is a nice to have based on challenges that have occurred in past database migrations. It is not currently needed, but could prove useful in the future. I would consider it low priority.

desertaxle avatar Aug 05 '22 16:08 desertaxle

The implementation of deterministic sorting of JSON for serialized flows in v1 may be useful for this.

zanieb avatar Aug 05 '22 16:08 zanieb