Skip to content

Commit

Permalink
MSSQL FF - TopicSuffix (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored May 18, 2024
1 parent ca97434 commit de94e70
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions sources/mssql/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package adapter
import (
"database/sql"
"fmt"
"strings"

"github.com/artie-labs/transfer/lib/ptr"

"github.com/artie-labs/reader/config"
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions sources/mysql/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion sources/mysql/adapter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestMySQLAdapter_TopicSuffix(t *testing.T) {
},
{
table: mysql.Table{
Name: `"PublicStatus"`,
Name: "PublicStatus",
},
expected: "db.PublicStatus",
},
Expand Down
3 changes: 1 addition & 2 deletions sources/postgres/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion sources/postgres/adapter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestPostgresAdapter_TopicSuffix(t *testing.T) {
},
{
table: postgres.Table{
Name: `"PublicStatus"`,
Name: "PublicStatus",
Schema: "schema2",
},
expectedTopicName: "schema2.PublicStatus",
Expand Down

0 comments on commit de94e70

Please sign in to comment.