Skip to main content

Module pk

Module pk 

Source
Expand description

Shared primary key hashing and formatting utilities.

This module is the single home for compact 64-bit hash representations of primary keys and for human-readable PK formatting, used by both the validate and diff commands for memory-efficient PK tracking. Keeping one implementation matters: these hashes are compared across modules, so divergent copies would silently break PK/FK and row comparisons.

Functions§

format_pk_tuple
Format a PK tuple as a string (single value as-is, composite as “(val1, val2)”).
format_single_pk
Format a single PK value as a string.
hash_pk_value_into
Feed a single PK/FK value into hasher, tag-discriminated so that e.g. Int(1) and Text("1") hash differently.
hash_pk_values
Hash a list of PK/FK values into a compact 64-bit hash. Uses AHash for fast, high-quality hashing.

Type Aliases§

PkHash
Compact primary key hash (64-bit). Collision risk is negligible for realistic dump sizes.