From 30dd1b2f3d8b629e5436262557b1585c5ab73790 Mon Sep 17 00:00:00 2001 From: Nathan Villaescusa Date: Wed, 1 May 2024 15:29:59 -0700 Subject: [PATCH] Revert "Rename back" This reverts commit 1191375a3e9ce93b34d1d345d2cb47d93fe66b79. --- clients/snowflake/snowflake.go | 4 ++-- lib/destination/dml/merge.go | 6 +++--- lib/sql/escape.go | 2 +- lib/typing/columns/columns.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clients/snowflake/snowflake.go b/clients/snowflake/snowflake.go index 372e7c3df..eec3b4dda 100644 --- a/clients/snowflake/snowflake.go +++ b/clients/snowflake/snowflake.go @@ -134,12 +134,12 @@ func (s *Store) reestablishConnection() error { func (s *Store) generateDedupeQueries(tableID, stagingTableID types.TableIdentifier, primaryKeys []string, topicConfig kafkalib.TopicConfig) []string { var primaryKeysEscaped []string for _, pk := range primaryKeys { - primaryKeysEscaped = append(primaryKeysEscaped, sql.EscapeNameIfNecessary(pk, s.Dialect())) + primaryKeysEscaped = append(primaryKeysEscaped, sql.EscapeNameIfNecessaryUsingDialect(pk, s.Dialect())) } orderColsToIterate := primaryKeysEscaped if topicConfig.IncludeArtieUpdatedAt { - orderColsToIterate = append(orderColsToIterate, sql.EscapeNameIfNecessary(constants.UpdateColumnMarker, s.Dialect())) + orderColsToIterate = append(orderColsToIterate, sql.EscapeNameIfNecessaryUsingDialect(constants.UpdateColumnMarker, s.Dialect())) } var orderByCols []string diff --git a/lib/destination/dml/merge.go b/lib/destination/dml/merge.go index 8e27504ae..0c69a0d82 100644 --- a/lib/destination/dml/merge.go +++ b/lib/destination/dml/merge.go @@ -134,7 +134,7 @@ func (m *MergeArgument) GetParts() ([]string, error) { // We also need to remove __artie flags since it does not exist in the destination table var removed bool for idx, col := range cols { - if col == sql.EscapeNameIfNecessary(constants.DeleteColumnMarker, m.Dialect) { + if col == sql.EscapeNameIfNecessaryUsingDialect(constants.DeleteColumnMarker, m.Dialect) { cols = append(cols[:idx], cols[idx+1:]...) removed = true break @@ -257,7 +257,7 @@ WHEN NOT MATCHED AND IFNULL(cc.%s, false) = false THEN INSERT (%s) VALUES (%s);` // We also need to remove __artie flags since it does not exist in the destination table var removed bool for idx, col := range cols { - if col == sql.EscapeNameIfNecessary(constants.DeleteColumnMarker, m.Dialect) { + if col == sql.EscapeNameIfNecessaryUsingDialect(constants.DeleteColumnMarker, m.Dialect) { cols = append(cols[:idx], cols[idx+1:]...) removed = true break @@ -327,7 +327,7 @@ WHEN NOT MATCHED AND COALESCE(cc.%s, 0) = 0 THEN INSERT (%s) VALUES (%s);`, // We also need to remove __artie flags since it does not exist in the destination table var removed bool for idx, col := range cols { - if col == sql.EscapeNameIfNecessary(constants.DeleteColumnMarker, m.Dialect) { + if col == sql.EscapeNameIfNecessaryUsingDialect(constants.DeleteColumnMarker, m.Dialect) { cols = append(cols[:idx], cols[idx+1:]...) removed = true break diff --git a/lib/sql/escape.go b/lib/sql/escape.go index c1f34bda7..60e330f41 100644 --- a/lib/sql/escape.go +++ b/lib/sql/escape.go @@ -1,6 +1,6 @@ package sql -func EscapeNameIfNecessary(name string, dialect Dialect) string { +func EscapeNameIfNecessaryUsingDialect(name string, dialect Dialect) string { if dialect.NeedsEscaping(name) { return dialect.QuoteIdentifier(name) } diff --git a/lib/typing/columns/columns.go b/lib/typing/columns/columns.go index 386d74ea8..78fad212f 100644 --- a/lib/typing/columns/columns.go +++ b/lib/typing/columns/columns.go @@ -87,7 +87,7 @@ func (c *Column) RawName() string { // Plus we will escape it if the column name is part of the reserved words from destinations. // If so, it'll change from `start` => `"start"` as suggested by Snowflake. func (c *Column) Name(dialect sql.Dialect) string { - return sql.EscapeNameIfNecessary(c.name, dialect) + return sql.EscapeNameIfNecessaryUsingDialect(c.name, dialect) } type Columns struct {