From de94e702acd06946dc67769cff5cfcc01d4bb889 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Fri, 17 May 2024 21:00:50 -0700 Subject: [PATCH] MSSQL FF - TopicSuffix (#391) --- sources/mssql/adapter/adapter.go | 4 +--- sources/mysql/adapter/adapter.go | 3 +-- sources/mysql/adapter/adapter_test.go | 2 +- sources/postgres/adapter/adapter.go | 3 +-- sources/postgres/adapter/adapter_test.go | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sources/mssql/adapter/adapter.go b/sources/mssql/adapter/adapter.go index db0df5c1..5362591c 100644 --- a/sources/mssql/adapter/adapter.go +++ b/sources/mssql/adapter/adapter.go @@ -3,8 +3,6 @@ package adapter import ( "database/sql" "fmt" - "strings" - "github.com/artie-labs/transfer/lib/ptr" "github.com/artie-labs/reader/config" @@ -62,7 +60,7 @@ func (m MSSQLAdapter) TableName() string { } func (m MSSQLAdapter) TopicSuffix() string { - return fmt.Sprintf("%s.%s.%s", m.dbName, m.table.Schema, strings.ReplaceAll(m.table.Name, `"`, ``)) + return fmt.Sprintf("%s.%s.%s", m.dbName, m.table.Schema, m.table.Name) } func (m MSSQLAdapter) FieldConverters() []transformer.FieldConverter { diff --git a/sources/mysql/adapter/adapter.go b/sources/mysql/adapter/adapter.go index 00bd21c0..c11748d1 100644 --- a/sources/mysql/adapter/adapter.go +++ b/sources/mysql/adapter/adapter.go @@ -4,7 +4,6 @@ import ( "database/sql" "fmt" "log/slog" - "strings" "github.com/artie-labs/reader/config" "github.com/artie-labs/reader/lib/debezium/converters" @@ -67,7 +66,7 @@ func (m MySQLAdapter) TableName() string { } func (m MySQLAdapter) TopicSuffix() string { - return fmt.Sprintf("%s.%s", m.dbName, strings.ReplaceAll(m.table.Name, `"`, ``)) + return fmt.Sprintf("%s.%s", m.dbName, m.table.Name) } func (m MySQLAdapter) FieldConverters() []transformer.FieldConverter { diff --git a/sources/mysql/adapter/adapter_test.go b/sources/mysql/adapter/adapter_test.go index 1579a01c..c1893120 100644 --- a/sources/mysql/adapter/adapter_test.go +++ b/sources/mysql/adapter/adapter_test.go @@ -36,7 +36,7 @@ func TestMySQLAdapter_TopicSuffix(t *testing.T) { }, { table: mysql.Table{ - Name: `"PublicStatus"`, + Name: "PublicStatus", }, expected: "db.PublicStatus", }, diff --git a/sources/postgres/adapter/adapter.go b/sources/postgres/adapter/adapter.go index 085d14b5..68a8f10d 100644 --- a/sources/postgres/adapter/adapter.go +++ b/sources/postgres/adapter/adapter.go @@ -4,7 +4,6 @@ import ( "database/sql" "fmt" "log/slog" - "strings" "github.com/artie-labs/reader/config" "github.com/artie-labs/reader/lib/debezium/converters" @@ -60,7 +59,7 @@ func (p PostgresAdapter) TableName() string { } func (p PostgresAdapter) TopicSuffix() string { - return fmt.Sprintf("%s.%s", p.table.Schema, strings.ReplaceAll(p.table.Name, `"`, ``)) + return fmt.Sprintf("%s.%s", p.table.Schema, p.table.Name) } func (p PostgresAdapter) FieldConverters() []transformer.FieldConverter { diff --git a/sources/postgres/adapter/adapter_test.go b/sources/postgres/adapter/adapter_test.go index 29d8c10b..4932d812 100644 --- a/sources/postgres/adapter/adapter_test.go +++ b/sources/postgres/adapter/adapter_test.go @@ -35,7 +35,7 @@ func TestPostgresAdapter_TopicSuffix(t *testing.T) { }, { table: postgres.Table{ - Name: `"PublicStatus"`, + Name: "PublicStatus", Schema: "schema2", }, expectedTopicName: "schema2.PublicStatus",