Skip to content

Commit

Permalink
Moving writes into redshift.go.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed May 2, 2024
1 parent 620638a commit e3c4c64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
13 changes: 13 additions & 0 deletions clients/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ type Store struct {
db.Store
}

func (s *Store) Append(tableData *optimization.TableData) error {
return shared.Append(s, tableData, types.AdditionalSettings{})
}

func (s *Store) Merge(tableData *optimization.TableData) error {
return shared.Merge(s, tableData, s.config, types.MergeOpts{
UseMergeParts: true,
// We are adding SELECT DISTINCT here for the temporary table as an extra guardrail.
// Redshift does not enforce any row uniqueness and there could be potential LOAD errors which will cause duplicate rows to arise.
SubQueryDedupe: true,
})
}

func (s *Store) IdentifierFor(topicConfig kafkalib.TopicConfig, table string) types.TableIdentifier {
return NewTableIdentifier(topicConfig.Schema, table)
}
Expand Down
20 changes: 0 additions & 20 deletions clients/redshift/writes.go

This file was deleted.

0 comments on commit e3c4c64

Please sign in to comment.