bug: UUID incremental replication keys cannot be compared with UUID-strings coming from the state #2754
Labels
Accepting Pull Requests
good first issue
Good for newcomers
kind/Bug
Something isn't working
urgency/Low
Milestone
Singer SDK Version
0.41.0
Is this a regression?
Python Version
NA
Bug scope
Taps (catalog, state, etc.)
Operating System
NA
Description
When a SQL tap defines a UUID column as a replication key, the step where the value coming from the record and the value coming from the state dictionary are compared to increment the bookmark crashes because the
>=
operation is not supported between auuid.UUID
1 instance and a string.We can fix by simply adding a branch to
sdk/singer_sdk/helpers/_typing.py
Lines 40 to 45 in ae7516b
that checks for an instance of
uuid.UUID
and returns the stringified value. The resulting string-to-string comparison should be safe down to the millisecond.Note
This may be only be an issue in a very narrow set of use cases, in particular where the experimental sortable UUID Version 72 is enabled via database extensions, such as
pg_uuidv7
3.Related:
Link to Slack/Linen
No response
Footnotes
https://docs.python.org/3/library/uuid.html#uuid.UUID ↩
https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7 ↩
https://github.com/craigpastro/pg_uuidv7 ↩
The text was updated successfully, but these errors were encountered: