From f3a735d7476f0a20beaa647ed78679baafc949d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Rami=CC=81rez=20Mondrago=CC=81n?= Date: Fri, 17 Jun 2022 17:18:55 -0500 Subject: [PATCH 1/2] fix: Check if RK is sortable before comparing --- singer_sdk/helpers/_state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singer_sdk/helpers/_state.py b/singer_sdk/helpers/_state.py index 08bc5b26b..57449348d 100644 --- a/singer_sdk/helpers/_state.py +++ b/singer_sdk/helpers/_state.py @@ -218,7 +218,7 @@ def increment_state( progress_dict = stream_or_partition_state[PROGRESS_MARKERS] old_rk_value = to_json_compatible(progress_dict.get("replication_key_value")) new_rk_value = to_json_compatible(latest_record[replication_key]) - if old_rk_value is None or new_rk_value >= old_rk_value or not check_sorted: + if old_rk_value is None or not check_sorted or new_rk_value >= old_rk_value: progress_dict["replication_key"] = replication_key progress_dict["replication_key_value"] = new_rk_value return From 0384daa4a71b88f828cffa73f5dbc232cd6f02bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Rami=CC=81rez=20Mondrago=CC=81n?= Date: Fri, 17 Jun 2022 17:19:49 -0500 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4cb50aa..3356487ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### New - Tap and Target SDK: Adds the ability to override the [logging level](https://sdk.meltano.com/en/latest/implementation/logging.html) via `LOGLEVEL` environment variables. ([!300](https://gitlab.com/meltano/sdk/-/merge_requests/300)) - Thanks, _**[Eric Boucher](https://gitlab.com/ericboucher)**_! +- Tap SDK: Compare replication key values when incrementing state, only if the `not check_sorted` flag is set to True ([#736](https://github.com/meltano/sdk/issues/736), [#737](https://github.com/meltano/sdk/pull/737)). ### Changes