Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Nov 15, 2023
1 parent 53d8615 commit 18fdd5c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flow/connectors/snowflake/snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,12 +1088,19 @@ func (c *SnowflakeConnector) generateAndExecuteMergeStatement(
fmt.Sprintf("(%s)", strings.Join(normalizedTableSchema.PrimaryKeyColumns, ",")),
pkeySelectSQL, insertColumnsSQL, insertValuesSQL, updateStringToastCols, deletePart)

startTime := time.Now()
result, err := normalizeRecordsTx.ExecContext(ctx, mergeStatement, destinationTableIdentifier)
if err != nil {
return 0, fmt.Errorf("failed to merge records into %s (statement: %s): %w",
destinationTableIdentifier, mergeStatement, err)
}

endTime := time.Now()
log.WithFields(log.Fields{
"flowName": destinationTableIdentifier,
}).Infof("[merge] merged records into %s, took: %d seconds",
destinationTableIdentifier, endTime.Sub(startTime)/time.Second)

return result.RowsAffected()
}

Expand Down

0 comments on commit 18fdd5c

Please sign in to comment.