Skip to content

Get last element as a table name from a topic name - #339

Open
IlyaTsoi wants to merge 1 commit into
Altinity:developfrom
IlyaTsoi:getTableNameFromTopic
Open

Get last element as a table name from a topic name#339
IlyaTsoi wants to merge 1 commit into
Altinity:developfrom
IlyaTsoi:getTableNameFromTopic

Conversation

@IlyaTsoi

Copy link
Copy Markdown
Contributor

It would be better if it didn't depend on the hard-coded ..

template

It would be better if it didn't depend on the hard-coded <server>.<database>.<table> template
@aadant
aadant requested a review from subkanthi October 25, 2023 04:22
@subkanthi

Copy link
Copy Markdown
Collaborator

DId you come across a bug for this, all the debezium connectors create topics in the following format.

<topicPrefix>.<schemaName>.<tableName>

Would be better to return a NULL table name instead of extracting a wrong table name and writing data to it.

@IlyaTsoi

IlyaTsoi commented Oct 25, 2023

Copy link
Copy Markdown
Contributor Author

In any case a table name is located at the end of the topic name. Isn't it? Current logic brakes when using topic.prefix in debezium config and we get null instead of table name. Of course topic2table mapping by regex will resolve this issue. My solution migth be used as workaround.

@IlyaTsoi

IlyaTsoi commented Nov 3, 2023

Copy link
Copy Markdown
Contributor Author

@subkanthi one more argument): when getTableNameFromTopic() returns null the table with this name will be created and the table will contain all columns from all source tables). Of course, replication will fail. I have not inspected why, but seen such behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants