hi guys, just a quick question - i'm trying to set...
# replication-troubleshooting
s
hi guys, just a quick question - i'm trying to set up an incremental connection with HTTP API, I"ve nearly got there but I'm puzzled over the initial setting of the state/cursor value when you run it for the first time. According to the tutorial, we should have something like this in read_records:
Copy code
def read_records(self, *args, **kwargs) -> Iterable[Mapping[str, Any]]:
        for record in super().read_records(*args, **kwargs):
            if self._cursor_value:
                latest_record_date = record[self.cursor_field]
                self._cursor_value = max(self._cursor_value, latest_record_date)
            yield record
and this is how we get the new state value for future runs to use. But the first time you run it, the self._cursor_value is set to None, so we never enter the if statement and update to the latest value. So what is supposed to happen here? How do we get the correct state returned at the end of the first run instead of the start date being returned unchanged?
✍️ 1
u
@[DEPRECATED] Marcos Marx turned this message into Zendesk ticket 2800 to ensure timely resolution!
u
Hi! Are you implementing the incremental stream using the
IncrementalMixin
as per the docs? This is the latest and recommended way of implementing an incremental stream: https://docs.airbyte.com/connector-development/cdk-python/incremental-stream/#incrementalmixin
s
Hi Nataly, yes I am using IncrementalMixin and set a state_checkpoint_interval. Using the started_at field which is a unix timestamp
u
Excellent! Please let me know how that goes and if you have any other questions!