Skip to content

Commit

Permalink
snapshot_flow: use table schema utils
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Dec 29, 2023
1 parent 268264c commit 4ff4d1e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions flow/workflows/snapshot_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"go.temporal.io/sdk/log"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
"golang.org/x/exp/maps"
)

type SnapshotFlowExecution struct {
Expand Down Expand Up @@ -141,17 +140,12 @@ func (s *SnapshotFlowExecution) cloneTable(
if len(mapping.Exclude) != 0 {
for _, v := range s.config.TableNameSchemaMapping {
if v.TableIdentifier == srcName {
if v.Columns != nil {
cols := maps.Keys(v.Columns)
for i, col := range cols {
cols[i] = fmt.Sprintf(`"%s"`, col)
}
from = strings.Join(cols, ",")
break
} else {
from = strings.Join(v.ColumnNames, ",")
break
colNames := utils.TableSchemaColumnNames(v)
for i, colName := range colNames {
colNames[i] = fmt.Sprintf(`"%s"`, colName)
}
from = strings.Join(colNames, ",")
break
}
}
}
Expand Down

0 comments on commit 4ff4d1e

Please sign in to comment.