Skip to content

Commit

Permalink
fix: copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Oct 16, 2023
1 parent 390ff8a commit 6631b0a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions flow/connectors/snowflake/qrep_avro_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ func (sc *SnowflakeConnector) GetCopyTransformation(dstTableName string) (*CopyI
}
colName := strings.ToLower(col)
// No need to quote raw table columns
if !strings.Contains(dstTableName, "_PEERDB_RAW") {
colName = fmt.Sprintf("\"%s\"", colName)
if strings.Contains(dstTableName, "_PEERDB_RAW") {
columnOrder = append(columnOrder, colName)
} else {
columnOrder = append(columnOrder, fmt.Sprintf("\"%s\"", colName))
}
columnOrder = append(columnOrder, colName)
log.Infof("colName: %s has type: %s", colName, colType)

switch colType {
case "GEOGRAPHY":
Expand Down Expand Up @@ -496,7 +496,6 @@ func (s *SnowflakeAvroWriteHandler) HandleUpsertMode(
//nolint:gosec
copyCmd := fmt.Sprintf("COPY INTO %s(%s) FROM (SELECT %s FROM @%s) %s",
tempTableName, copyInfo.columnsSQL, copyInfo.transformationSQL, s.stage, strings.Join(s.copyOpts, ","))
log.Info("Copy command in handleupsert: ", copyCmd)
_, err = s.connector.database.Exec(copyCmd)
if err != nil {
return fmt.Errorf("failed to run COPY INTO command: %w", err)
Expand Down

0 comments on commit 6631b0a

Please sign in to comment.