Skip to content

Commit bd9aa4e

Browse files
authored
add opencdc.collection metadata key for snapshots (#241)
* add opencdc.collection metadata key for snapshots * update test
1 parent 134b515 commit bd9aa4e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

source/snapshot/iterator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (i *Iterator) buildRecord(d FetchData) opencdc.Record {
120120

121121
pos := i.lastPosition.ToSDKPosition()
122122
metadata := make(opencdc.Metadata)
123-
metadata["postgres.table"] = d.Table
123+
metadata[opencdc.MetadataCollection] = d.Table
124124

125125
rec := sdk.Util.Source.NewRecordSnapshot(pos, metadata, d.Key, d.Payload)
126126
if i.conf.WithAvroSchema {

source/snapshot/iterator_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func Test_Iterator_Next(t *testing.T) {
5252
r, err := i.Next(ctx)
5353
is.NoErr(err)
5454
is.Equal(r.Operation, opencdc.OperationSnapshot)
55+
is.Equal(r.Metadata[opencdc.MetadataCollection], table)
5556
}
5657

5758
for j := 1; j <= 4; j++ {

0 commit comments

Comments
 (0)