From 7910ecbb0cdea474d7a44dd8c3e5e1d940fea594 Mon Sep 17 00:00:00 2001 From: Wouter de Vries Date: Wed, 13 Sep 2023 14:21:16 +0200 Subject: [PATCH] Omit replicationKeyValue param if there's no starting_timestamp This is different from setting replicationKeyValue to None, which would cause GraphQL to actually filter on `updatedAt > null`. --- tap_linear/client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tap_linear/client.py b/tap_linear/client.py index 6825b9d..5a25c8b 100644 --- a/tap_linear/client.py +++ b/tap_linear/client.py @@ -2,7 +2,6 @@ from __future__ import annotations -from datetime import timedelta from typing import Any from singer_sdk.authenticators import APIKeyAuthenticator @@ -53,8 +52,10 @@ def get_url_params( Returns: A dictionary of URL params. """ - next_second = self.get_starting_timestamp(context) + timedelta(seconds=1) - return { - "next": next_page_token, - "replicationKeyValue": next_second.strftime("%Y-%m-%dT%H:%M:%SZ"), - } + params = {"next": next_page_token} + + if starting_timestamp := self.get_starting_timestamp(context): + replication_key_value = starting_timestamp.strftime("%Y-%m-%dT%H:%M:%SZ") + params["replicationKeyValue"] = replication_key_value + + return params