DataLinkDC / dinky

Dinky is a real-time data development platform based on Apache Flink, enabling agile data development, deployment and operation.
http://www.dinky.org.cn
Apache License 2.0
3.15k stars 1.16k forks source link

[Bug] [Module Name] org.apache.flink.sql.parser.impl.ParseException: Encountered "-" When the database name contains a hyphen -, the entire database synchronizes and reports an error #3636

Closed Lordeath closed 1 month ago

Lordeath commented 4 months ago

Search before asking

What happened

数据库名称带横杠-时,全库同步报错 When the database name contains a dash -, a full database synchronization error is reported

2024-07-10 10:09:03.683 ERROR org.dinky.cdc.AbstractSinkBuilder(159): org.apache.flink.table.api.SqlParserException: Invalid SQL identifier VIEW_xxxxxx-xxxx_table_name. Caused by: org.apache.flink.sql.parser.impl.ParseException: Encountered "-" at line 1, column 12.

What you expected to happen

我期望可以支持带横杠的数据库做全库同步。 我查看了源码,可以修改 getSchemaTableNameWithUnderline 这个方法,来替换横杠为下划线,以此来支持带有横杠的数据库

I hope to support databases with dashes for full database synchronization. I checked the source code and found that the getSchemaTableNameWithUnderline method can be modified to replace dashes with underscores to support databases with dashes.

How to reproduce

EXECUTE CDCSOURCE jobname WITH ( 'connector' = 'mysql-cdc', 'hostname' = 'xxxxx', 'port' = '3306', 'username' = 'xxxxx', 'password' = 'xxxxx', 'checkpoint' = '3000', 'scan.startup.mode' = 'initial', 'parallelism' = '1', 'server-time-zone' = 'Asia/Shanghai', 'source.scan.incremental.snapshot.chunk.size' = '8096', 'source.scan.snapshot.fetch.size' = '1024', 'table-name' = 'xxxxxx-xxxx.table_name_1,xxxxxx-xxxx.table_name_2', 'sink.connector' = 'starrocks', 'sink.jdbc-url' = 'jdbc:mysql://xxxxx', 'sink.load-url' = 'xxxxx', 'sink.username' = 'xxxxx', 'sink.password' = 'xxxxx', 'sink.sink.db' = 'xxxxx', 'sink.table.prefix' = '', 'sink.table.lower' = 'true', 'sink.database-name' = 'xxxxx', 'sink.table-name' = '#{tableName}', 'sink.sink.properties.format' = 'json', 'sink.sink.properties.strip_outer_array' = 'true', 'sink.sink.max-retries' = '10', 'sink.sink.buffer-flush.interval-ms' = '5000', 'sink.sink.parallelism' = '1' )

Anything else

我可以自己尝试修改一下,fork之后自己改一下,看看能不能提交一个PR

Version

dev

Are you willing to submit PR?

Code of Conduct

github-actions[bot] commented 2 months ago

Hello @, this issue has not been active for more than 30 days. This issue will be closed in 7 days if there is no response. If you have any questions, you can comment and reply.

你好 @, 这个 issue 30 天内没有活跃,7 天后将关闭,如需回复,可以评论回复。