yggdrasil.io.delta.snapshot¶
snapshot ¶
Snapshot — collapsed table state at a specific Delta version.
Snapshot
dataclass
¶
Snapshot(
version: int,
table_root: "Path",
protocol: Protocol = Protocol(),
metadata: Optional[Metadata] = None,
active_files: "Dict[str, AddFile]" = dict(),
txns: "Dict[str, int]" = dict(),
domain_metadata: "Dict[str, DomainMetadata]" = dict(),
)
clustering_columns
property
¶
Liquid-clustering columns for this table, in cluster-key order.
Databricks records liquid clustering in a domainMetadata
action under the delta.clustering domain — not in
metaData.partitionColumns (a clustered table is unpartitioned).
The domain config looks like::
{"clusteringColumns": [["region"], ["id"]],
"domainName": "delta.clustering"}
where each entry is a physical column path (a list, to address
nested struct fields). We flatten each path with . so a
top-level column region surfaces as "region" and a nested
addr.zip as "addr.zip" — the same dotted name the read
predicate uses.
Older / non-Databricks writers sometimes stamp the columns in
metaData.configuration['delta.clusteringColumns'] as a
comma-joined string instead; we accept that shape as a fallback so
a table written either way reports the same key. Returns [] when
the table isn't clustered.
total_bytes
property
¶
Sum of the active data files' on-disk sizes (from AddFile.size).
advanced ¶
Return a new snapshot = this state + the actions in commit_files.
Used to advance a cached snapshot to a newer version by replaying
only the commits after it — no checkpoint read, no re-reading the
prior commits. commit_files are the (ascending) commit JSONs for
versions (self.version, version] (see :meth:DeltaLog.commits_after).