Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renaming tables when copying from postgres #435

Closed
tellienne opened this issue Jan 12, 2024 · 6 comments · Fixed by #439
Closed

renaming tables when copying from postgres #435

tellienne opened this issue Jan 12, 2024 · 6 comments · Fixed by #439

Comments

@tellienne
Copy link

Hi!
We use the connector to copy data from postgresql to clickhouse. We have a problem related to naming tables in PostgreSQL.
The table name in the PostgreSQL database contains '-', for example, 'test-table-master'. We enabled auto-creation of tables and now the connector tries to create a table with the same name in the clickhouse. As a result, we get a syntax error in clickhose.
Is it possible to replace '-' with '_' when auto-creation of tables in clickhouse is enabled? For example, rename 'test-table-master' on 'test_table_master'.
Or maybe you know another solution? :(

@subkanthi
Copy link
Collaborator

Hi @tellienne ,
We currently dont have the feature of providing table name overrides.
we will have this implemented soon.

cc: @aadant

@subkanthi
Copy link
Collaborator

will add a quick fix to replace '-' with '_' for now.

@aadant
Copy link
Collaborator

aadant commented Jan 13, 2024

@subkanthi - should work in clickhouse if the table names are escaped ! Maybe it is an old issue.

@tellienne
Copy link
Author

We use docker-image altinityinfra/clickhouse-sink-connector:405-fe4aa9de369b639a59f579a81d0fdd5d3ac32f97-lt.

connector logs:
Caused by: java.io.IOException: Code: 62. DB::Exception: Syntax error: failed at position 19 ('-'): -history_2023_05(supplier_guid String NOT NULL,supplier_id UUID NOT NULL,supplier_store_id String NOT NULL,day_updated_at DateTime64(6) NOT NULL,base_u. Expected one of: token, Dot, UUID, ON, OpeningRoundBracket, storage definition, ENGINE, PARTITION BY, PRIMARY KEY, ORDER BY, SAMPLE BY, TTL, EMPTY AS, AS, COMMENT, INTO OUTFILE, FORMAT, SETTINGS, end of query. (SYNTAX_ERROR) (version 23.10.5.20 (official build))`

the table is called price-history_2023_05.

We copy all tables from the public schema without specifying 'table.include.list'

@aadant
Copy link
Collaborator

aadant commented Jan 13, 2024

@subkanthi I believe this was fixed by this bug fix #413

@subkanthi
Copy link
Collaborator

@tellienne the fix was added , please try this docker tag altinityinfra/clickhouse-sink-connector:439-dfd65c5fddb2ddac0380ecc116a87ccc20ec7aa9-lt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants