Skip to content

Commit

Permalink
remove excluded columns from PrimaryKeyColumns during processing (#2170)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Oct 22, 2024
1 parent 02fe7d0 commit 6ce2678
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion flow/shared/schema_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ func BuildProcessedSchemaMapping(
dstTableName = mapping.DestinationTableIdentifier
if len(mapping.Exclude) != 0 {
columns := make([]*protos.FieldDescription, 0, len(tableSchema.Columns))
pkeyColumns := make([]string, 0, len(tableSchema.PrimaryKeyColumns))
for _, column := range tableSchema.Columns {
if !slices.Contains(mapping.Exclude, column.Name) {
columns = append(columns, column)
}
if slices.Contains(tableSchema.PrimaryKeyColumns, column.Name) &&
!slices.Contains(mapping.Exclude, column.Name) {
pkeyColumns = append(pkeyColumns, column.Name)
}
}
tableSchema = &protos.TableSchema{
TableIdentifier: tableSchema.TableIdentifier,
PrimaryKeyColumns: tableSchema.PrimaryKeyColumns,
PrimaryKeyColumns: pkeyColumns,
IsReplicaIdentityFull: tableSchema.IsReplicaIdentityFull,
NullableEnabled: tableSchema.NullableEnabled,
System: tableSchema.System,
Expand Down

0 comments on commit 6ce2678

Please sign in to comment.