Skip to content

Commit

Permalink
add opencdc.collection metadata key for snapshots (#241)
Browse files Browse the repository at this point in the history
* add opencdc.collection metadata key for snapshots

* update test
  • Loading branch information
maha-hajja authored Jan 15, 2025
1 parent 134b515 commit bd9aa4e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/snapshot/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (i *Iterator) buildRecord(d FetchData) opencdc.Record {

pos := i.lastPosition.ToSDKPosition()
metadata := make(opencdc.Metadata)
metadata["postgres.table"] = d.Table
metadata[opencdc.MetadataCollection] = d.Table

rec := sdk.Util.Source.NewRecordSnapshot(pos, metadata, d.Key, d.Payload)
if i.conf.WithAvroSchema {
Expand Down
1 change: 1 addition & 0 deletions source/snapshot/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func Test_Iterator_Next(t *testing.T) {
r, err := i.Next(ctx)
is.NoErr(err)
is.Equal(r.Operation, opencdc.OperationSnapshot)
is.Equal(r.Metadata[opencdc.MetadataCollection], table)
}

for j := 1; j <= 4; j++ {
Expand Down

0 comments on commit bd9aa4e

Please sign in to comment.