Skip to content

Commit

Permalink
fix resync syntax error (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Feb 13, 2024
1 parent 1da535b commit 53047e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flow/connectors/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,8 @@ func (c *BigQueryConnector) RenameTables(ctx context.Context, req *protos.Rename
}
}

allCols := allColsBuilder.String()
allColsWithoutAlias := strings.Join(columnNames, ",")
allColsWithAlias := allColsBuilder.String()

pkeyCols := strings.Join(renameRequest.TableSchema.PrimaryKeyColumns, ",")

Expand All @@ -840,8 +841,8 @@ func (c *BigQueryConnector) RenameTables(ctx context.Context, req *protos.Rename
activity.RecordHeartbeat(ctx, fmt.Sprintf("handling soft-deletes for table '%s'...", dstDatasetTable.string()))

q := fmt.Sprintf("INSERT INTO %s(%s) SELECT %s,true AS %s FROM %s _pt WHERE (%s) NOT IN (SELECT %s FROM %s)",
srcDatasetTable.string(), fmt.Sprintf("%s,%s", allCols, *req.SoftDeleteColName),
allCols, *req.SoftDeleteColName, dstDatasetTable.string(),
srcDatasetTable.string(), fmt.Sprintf("%s,%s", allColsWithoutAlias, *req.SoftDeleteColName),
allColsWithAlias, *req.SoftDeleteColName, dstDatasetTable.string(),
pkeyCols, pkeyCols, srcDatasetTable.string())

c.logger.Info(q)
Expand Down

0 comments on commit 53047e2

Please sign in to comment.