I have an issue where I’ve configured an increment...
# ask-ai
e
I have an issue where I’ve configured an incremental sync using a step of one day, but the state never updates to display the end_time and always starts from the beginning. This is the yaml: incremental_sync: type: DatetimeBasedCursor cursor_field: created start_datetime: type: MinMaxDatetime datetime: “2025-10-01T000000Z” datetime_format: “%Y-%m-%dT%H:%M:%SZ” datetime_format: “%Y-%m-%dT%H:%M:%S-04:00” cursor_datetime_formats: - “%Y-%m-%dT%H:%M:%S%z” cursor_granularity: PT0.000001S step: P1D No matter how many times I run the sync (and yes, I’m running it incrementally) it never updates the state. The cursor is always set to the start date.
k
Based on the information in the knowledge sources, your issue likely stems from a mismatch between the format of the cursor field in your records and the configuration in your YAML, or from the way the state is being managed. Here are the key points to check: 1. Cursor Field Format Mismatch The
cursor_datetime_formats
should match the format of the
created
field in your records. If your records have a timezone offset (e.g.,
-04:00
), then
%Y-%m-%dT%H:%M:%S%z
is correct. However, your
datetime_format
for outgoing requests is set to
"%Y-%m-%dT%H:%M:%S-04:00"
, which is a static offset, not a format string. It should be a format string using
%z
for the offset, like
"%Y-%m-%dT%H:%M:%S%z"
. 2. State Update Mechanism The state is updated based on the value of the last record's
cursor_field
(in your case,
created
). If no records are returned, or if the
created
field is not present or not in the expected format, the state will not advance and will remain at the start date. > The Stream's state will be derived by reading the record's
cursor_field
. If the
cursor_field
is
updated_at
, and the record is
{"id": 1234, "updated_at": "2021-02-02T00:00:00.000000+0000"}
, then the state after reading that record is
"updated_at": "2021-02-02T00:00:00.000000+0000"
[Incremental Syncs - DatetimeBasedCursor](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#datetimebasedcursor). 3. No Records Returned If your API is not returning any records for the given date range, the state will not advance. Double-check that your API is returning records with the
created
field in the expected format for the date range you are testing. 4. Correct Use of
step
and
cursor_granularity
Your use of
step: P1D
and
cursor_granularity: PT0.000001S
is valid, but ensure that the granularity matches the smallest increment in your datetime format and data. Suggested Fixes: - Change your
datetime_format
to use a format string, not a static offset:
Copy code
yaml   datetime_format: "%Y-%m-%dT%H:%M:%S%z"
- Ensure your
cursor_datetime_formats
matches the actual format of the
created
field in your records. - Verify that your API is returning records for the specified date range and that the
created
field is present and correctly formatted. Example Corrected YAML:
Copy code
yaml incremental_sync:   type: DatetimeBasedCursor   cursor_field: created   start_datetime:     type: MinMaxDatetime     datetime: "2025-10-01T00:00:00Z"     datetime_format: "%Y-%m-%dT%H:%M:%SZ"   datetime_format: "%Y-%m-%dT%H:%M:%S%z"   cursor_datetime_formats:     - "%Y-%m-%dT%H:%M:%S%z"   cursor_granularity: PT0.000001S   step: P1D
If after these changes the state still does not update, check your API responses and logs to ensure records are being returned and parsed as expected. If the
created
field is missing or in a different format, the state will not advance. For more details, see the documentation on [DatetimeBasedCursor incremental syncs](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/incremental-syncs#datetimebasedcursor).
e
this is an example of the “created” field that’s returned: 2025-10-02T035606Z - is my formatting wrong? @kapa.ai