fix: auto select cursor field for default incremental sync mode (#976)#985
fix: auto select cursor field for default incremental sync mode (#976)#985Saquib1973 wants to merge 10 commits into
Conversation
|
@nayanj98 my pr is ready for review |
|
Assigning @vaibhav-datazip to review your PR |
| convStream.SyncMode = types.CDC | ||
| } else if convStream.SupportedSyncModes.Exists(types.INCREMENTAL) { | ||
| convStream.SyncMode = types.INCREMENTAL | ||
| if convStream.CursorField == "" && convStream.AvailableCursorFields.Len() > 0 { |
There was a problem hiding this comment.
isn't cursorField = "" guard redundant ?
also can you add a crisp and clear comment here why this has been added and how it helps
There was a problem hiding this comment.
According to the issue, user can select cursorField during discover
- If cursorField already filled skip
- If the cursorField is empty and there is a availableCursorFields, set cursrorField to the first availableCursorField
There was a problem hiding this comment.
no I am saying can this ever happen that we get cursorField as non empty in discover function here
There was a problem hiding this comment.
In Discover(), every column is added to AvailableCursorFields using WithCursorField() while generating productSchema, but cursorField is never set.
| if oldStream.Stream.CursorField != "" { | ||
| newStream.Stream.CursorField = oldStream.Stream.CursorField | ||
| } |
There was a problem hiding this comment.
add a test case for this in catalog_test as well
… incremental sync" This reverts commit 21372fe.
Signed-off-by: nayanj98 <nayan@datazip.io> Co-authored-by: nayanj98 <nayan@datazip.io> Co-authored-by: Cursor <cursoragent@cursor.com>
…uib1971/olake into fix-auto-select-cursor-field
Description
Automatically assigns the first available cursor field when the default sync mode is
INCREMENTALduring the discovery phase. Additionally, updatesmergeCatalogsto prevent an old catalog's empty cursor field from overwriting the newly auto-selected default, while still preserving explicit user choices.Fixes #976
Type of change
How Has This Been Tested?
Tested locally using a PostgreSQL database configured without CDC support to force the
INCREMENTALfallback.discovercommand on PostgreSQL to verifystreams.jsoncorrectly populates thecursor_fieldwith the 0th available field instead of an empty string.synccommand on PostgreSQL to confirm the pipeline executes successfully without thezero-length delimited identifierSQL error.Screenshots or Recordings
2026-06-11.23-21-05.mp4
Documentation
Related PR's (If Any):
None