fix: reword snapshot timestamp mismatch warning to point at snapshot_get_time - #16303
Open
HannanNaeem wants to merge 1 commit into
Open
HannanNaeem wants to merge 1 commit into
HannanNaeem wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves https://github.com/dbt-labs/fs/issues/14450
Ports: #16106
Problem
The
SnapshotTimestampWarning(Q043) message misdescribes both the cause and the fix:Two problems:
snapshot_get_time()and theupdated_at-derived timestamp columns.snapshot_get_time()only feeds written values when closing out hard-deleted rows, so "snapshot table timestamp columns" is misleading about what is actually affected.updated_atconfig does not resolve the mismatch —updated_atpoints at the user's own source column, and repointing it changes snapshot semantics. The actual fix is to overridesnapshot_get_timeso it emits a matching type.Users have reasonably read this warning as "your
updated_atconfig is wrong" and gone looking for a problem that is not there.Solution
Reword the message:
This states what is actually affected (hard-delete timestamps), what the consequence is (implicit conversion on closeout), and the remediation that works.
This is a port of the same fix already made in Fusion. The wording matches that implementation word for word, with two deliberate omissions: Fusion interpolates the snapshot name and appends a
--> pathlocation hint, neither of which is available here because theQ043proto message carries only the two data-type strings. Adding them would require a new proto field inproto-python-publicand is out of scope.This is only half the fix. The warning also fires when it should not — under the default
hard_deletes: ignore,snapshot_get_time()never feeds a written column, so the comparison is a false positive. That gate lives incheck_time_data_typesindbt-adaptersand is handled in a companion PR: dbt-labs/dbt-adapters#.Merge order matters. This PR must merge first.
core/hatch.tomlinstallsdbt-adaptersfrom@mainunpinned, so the companion PR reaches this branch's CI the moment it merges.tests/functional/snapshots/test_snapshot_timestamps.pytherefore gainshard_deletes: invalidateon its fixture here, which keeps it green against both the current and the gated macro — making this PR safe to merge in isolation and in either order relative to the companion.Testing
tests/functional/snapshots/test_snapshot_timestamps.py— assertion updated to the new wording, fixture givenhard_deletes: invalidate. Passes against the current unmodifieddbt-adapters@main, and confirmed to fail if thetypes.pychange is reverted.tests/functional/snapshots/suite: 43 passed — confirmshard_deletes: invalidatedoes not otherwise perturb the fixture.tests/unit/test_events.pypasses unmodified; it constructsQ043but asserts nothing about its text.A negative regression test (no warning under the default
hard_deletes) is deliberately not included here — it cannot pass until the companiondbt-adaptersPR merges. It will follow.dbt-labs/dbt-adapters#2174
Checklist