kapa.ai
08/06/2025, 6:36 AMpython @property def state(self) -> Mapping[str, Any]: return {"JournalNumber": self._journal_number} @state.setter def state(self, value: Mapping[str, Any]): self._journal_number = value.get("JournalNumber", 0) 2. Update the state during sync: As you process records in your read_records method, update self._journal_number to the maximum JournalNumber seen so far: python def read_records(self, ...): for record in records: journal_number = record["JournalNumber"] self._journal_number = max(self._journal_number, journal_number) yield record 3. Airbyte will persist and pass this state between syncs, so the next sync will start from the last saved JournalNumber. On the next run, your stream will receive the last state and can use it to filter or request only records with a JournalNumber greater than the saved value. This approach is the standard way to implement incremental syncs in Airbyte using a custom cursor field, as described in the documentation for incremental streams and state management in the Airbyte CDK. The state is persisted by Airbyte and automatically provided to your connector on subsequent syncs, so you do not need to manage external storage for the state yourself unless you have a very specific use case outside of Airbyte's standard flow. For more details, see the official documentation on incremental streams and state management in the Airbyte CDK: - [Incremental Streams in Airbyte CDK](https://docs.airbyte.com/platform/connector-development/cdk-python/incremental-stream) - [State & Checkpointing](https://docs.airbyte.com/platform/understanding-airbyte/airbyte-protocol#state--checkpointing) If you follow this pattern, Airbyte will handle the persistence and restoration of the JournalNumber state for you automatically.