<@U04S8PLJWMT> What is the lookback_window field i...
# ask-ai
j
@kapa.ai What is the lookback_window field in the stream state?
k
The
lookback_window
field in the stream state refers to a duration (expressed as an ISO8601 interval, e.g.,
P1D
for 1 day,
P1M
for 1 month) that determines how far back in time the connector should re-fetch data during each incremental sync. This is useful for capturing late-arriving or updated records that may have changed after their initial ingestion. When a lookback window is configured, Airbyte will, on each sync, fetch records starting from the last known state minus the lookback window. For example, if the last synced record was from
2023-04-15
and the lookback window is 2 days, the next sync will start from
2023-04-13
. This helps ensure that any updates to records within that window are not missed, especially for APIs that do not support filtering by modification date, only by creation date. The value of
lookback_window
is stored in the stream state and is used to control this behavior for each stream. The field can be set in the connector configuration and is persisted in the state to ensure consistent incremental syncs across runs. The lookback window is typically specified in the connector's YAML configuration or via the UI, and its value can be customized per stream or globally, depending on the connector implementation. Example values include
P1D
,
P7D
, or
P1M
for 1 day, 7 days, or 1 month, respectively. For more details and examples, see the documentation on [DatetimeBasedCursor and lookback_window](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#datetimebasedcursor) and the [YAML reference](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/DatetimeBasedCursor).
j
@kapa.ai Why is it stored in the stream state for some streams even though there is no lookback_window defined in the cursor?
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not explicitly explain why the
lookback_window
field might be stored in the stream state for some streams even when no
lookback_window
is defined in the cursor. The documentation describes how the
lookback_window
is used and configured, but it does not address this specific scenario or the internal logic that would cause the field to appear in the state without being set in the configuration or cursor definition. If you are experiencing this behavior, it may be due to connector-specific implementation details or a bug, as hinted at in user reports and issues, but the official documentation does not provide a definitive answer for this caseĀ [Amazon Ads connector incremental sync not working](https://github.com/airbytehq/airbyte/issues/54649).