Skip to content

Commit

Permalink
not that stupid
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal committed Dec 13, 2024
1 parent 7b3f323 commit 8b9d175
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions flow/workflows/snapshot_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,16 @@ func (s *SnapshotFlowExecution) cloneTable(
s.logger.Error("unable to parse source table", slog.Any("error", err), cloneLog)
return fmt.Errorf("unable to parse source table: %w", err)
}
from := "*"
if err := initTableSchema(); err != nil {
return err
}
if len(mapping.Exclude) != 0 || shared.TableSchemaHasColumnsWithSubstr(tableSchema, "-") {
quotedColumns := make([]string, 0, len(tableSchema.Columns))
for _, col := range tableSchema.Columns {
if !slices.Contains(mapping.Exclude, col.Name) && !strings.Contains(col.Name, "-") {
quotedColumns = append(quotedColumns, connpostgres.QuoteIdentifier(col.Name))
}
quotedColumns := make([]string, 0, len(tableSchema.Columns))
for _, col := range tableSchema.Columns {
if !slices.Contains(mapping.Exclude, col.Name) && !strings.Contains(col.Name, "-") {
quotedColumns = append(quotedColumns, connpostgres.QuoteIdentifier(col.Name))
}
from = strings.Join(quotedColumns, ",")
}
from := strings.Join(quotedColumns, ",")
var query string
if mapping.PartitionKey == "" {
query = fmt.Sprintf("SELECT %s FROM %s", from, parsedSrcTable.String())
Expand Down

0 comments on commit 8b9d175

Please sign in to comment.