From 0ec4e74aaa6f761b83cd919006a4843f41bd1128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Mon, 8 Apr 2024 09:42:15 -0600 Subject: [PATCH] fix: Use `updated` as the replication key for the `issues` stream --- tap_jira/streams.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tap_jira/streams.py b/tap_jira/streams.py index 04f2386..7521a7e 100644 --- a/tap_jira/streams.py +++ b/tap_jira/streams.py @@ -387,7 +387,7 @@ class IssueStream(JiraStream): name = "issues" path = "/search" primary_keys = ["id"] - replication_key = "id" + replication_key = "updated" replication_method = "INCREMENTAL" records_jsonpath = "$[issues][*]" # Or override `parse_response`. instance_name = "issues" @@ -2316,8 +2316,9 @@ def get_child_context(self, record: dict, context: Optional[dict]) -> dict: """Return a context dictionary for child streams.""" return {"issue_id": record["id"]} - def post_process(self, row: dict, context: dict | None = None) -> dict | None: - # dafault value for array, would remove once handled at SDK level + def post_process(self, row: dict, context: dict | None = None) -> dict | None: # noqa: ARG002 + """Post process each row before returning to the SDK.""" + # default value for array, would remove once handled at SDK level for key_set_default in [ "customfield_10010", "customfield_10005", @@ -2346,6 +2347,9 @@ def post_process(self, row: dict, context: dict | None = None) -> dict | None: ]: if row["fields"].get(key_set_default) is None: row["fields"][key_set_default] = [] + + row["created"] = row["fields"].get("created") + row["updated"] = row["fields"].get("updated") return row