Skip to content

feat: upsert mode in Kafka(source) - #1161

Open
sahitya-datazip wants to merge 2 commits into
stagingfrom
upsert-in-kafka
Open

feat: upsert mode in Kafka(source)#1161
sahitya-datazip wants to merge 2 commits into
stagingfrom
upsert-in-kafka

Conversation

@sahitya-datazip

Copy link
Copy Markdown
Collaborator

Description

Added source side Kafka Upsert support.
When append_mode is false and dedup_keys are set on streams

  • Records with at least one non-null selected dedup field upsert via _olake_id derived from those keys
  • Missing selected dedup fields append (offset/partition identity)
  • All selected dedup fields present but null fail the sync
  • Mode A (dedup_keys = ["_kafka_key"] only): Upsert + Kafka tombstones deletes
  • Mode B (dedup_keys = selected fields): Upsert only

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Locally tested Upsert cases
  • Unit tests

Documentation

  • Documentation Link: [link to README, olake.io/docs, or olake-docs]
  • N/A (bug fix, refactor, or test changes only)

Comment thread types/kafka_types.go

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should migrate Kafka types to the drivers/kafka having it in common code is not correct.
Please migrate it.

@sahitya-datazip sahitya-datazip Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also have to migrate pkg/kafka into drivers/kafka

Comment thread types/catalog.go
ChunkColumn string `json:"chunk_column,omitempty"`
PartitionRegex string `json:"partition_regex"`
StreamName string `json:"stream_name"`
AppendMode bool `json:"append_mode,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think of adding some enum here like Mode and have the upsert follow the enum naming

Comment thread types/catalog.go
FilterConfig *FilterConfig `json:"filter_config,omitempty"`
SelectedColumns *SelectedColumns `json:"selected_columns"`

DedupKeys []string `json:"dedup_keys,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to Validate presence of at least dedup key in case of upsert mode.

Also do you think dedup_columns might make more sense given all other configs use column by convention?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validation in upsert.go
PRD mentions dedup_keys

return false, err
}
}
} else {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a separate function that will resolve the olake_id from kafkaesque record, that will help us to write unit tests clearly for all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants