Skip to content

Commit

Permalink
cleaning up Avro files for Snowflake CDC (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Dec 8, 2023
1 parent 21828e2 commit de62091
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flow/connectors/snowflake/qrep_avro_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (s *SnowflakeAvroSyncMethod) SyncRecords(
"destinationTable": dstTableName,
}).Infof("copying records into %s from stage %s", s.config.DestinationTableIdentifier, stage)

return numRecords, nil
return numRecords, os.Remove(localFilePath)
}

func (s *SnowflakeAvroSyncMethod) SyncQRepRecords(
Expand Down Expand Up @@ -275,8 +275,9 @@ func (s *SnowflakeAvroSyncMethod) writeToAvroFile(
var numRecords int
if s.config.StagingPath == "" {
ocfWriter := avro.NewPeerDBOCFWriterWithCompression(s.connector.ctx, stream, avroSchema)
tmpDir, err := os.MkdirTemp("", "peerdb-avro")
if err != nil {
tmpDir := fmt.Sprintf("%s/peerdb-avro-%s", os.TempDir(), flowJobName)
err := os.Mkdir(tmpDir, os.ModePerm)
if err != nil && !os.IsExist(err) {
return 0, "", fmt.Errorf("failed to create temp dir: %w", err)
}

Expand Down

0 comments on commit de62091

Please sign in to comment.