Skip to content

Commit

Permalink
Enclose Pod labels with single quote for Snowflake usecases
Browse files Browse the repository at this point in the history
In this commit, we updated the s3 uploader inside Flow Aggregator to
enclose Pod label fields with single quote for snowflake usecases.
Because commas are used to separate different columns in CSV and Pod
labels json string contains commas, we enclose it with single quote to
avoid them being separated into multiple columns in Snowflake.

Signed-off-by: Yongming Ding <dyongming@vmware.com>
  • Loading branch information
dreamtalen committed Oct 25, 2022
1 parent 57bcdc0 commit 822d486
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/flowaggregator/s3uploader/s3uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,10 @@ func writeRecord(w io.Writer, r *flowrecord.FlowRecord, clusterUUID string) {
io.WriteString(w, ",")
io.WriteString(w, fmt.Sprintf("%d", r.FlowType))
io.WriteString(w, ",")
io.WriteString(w, r.SourcePodLabels)
// Enclose Pod labels with single quote for Snowflake usecases
io.WriteString(w, fmt.Sprintf("'%s'", r.SourcePodLabels))
io.WriteString(w, ",")
io.WriteString(w, r.DestinationPodLabels)
io.WriteString(w, fmt.Sprintf("'%s'", r.DestinationPodLabels))
io.WriteString(w, ",")
io.WriteString(w, fmt.Sprintf("%d", r.Throughput))
io.WriteString(w, ",")
Expand Down

0 comments on commit 822d486

Please sign in to comment.