Reputation: 3956
My clickhouse db runs on some_ip:8122
clickhouse db:
create table chtable
(
val_1 UInt32,
val_2 UInt32,
val_date_full DateTime,
val_id UInt64,
val_date_short Date
)
engine = MergeTree(val_date_short, val_id , 8192);
My postgresql db runs on another_ip:5437
postgresql db:
create table psqltable
(
val_1 integer,
val_2 integer,
val_date_full timestamp,
val_id integer,
val_date_short date
val_id integer not null,
val_date_short date not null,
constraint psqltable_pkey
primary key (val_date_short, val_id)
);
How do I copy data from the clickhouse db to the postgresql db (running on different machines) ?
Upvotes: 4
Views: 2389
Reputation: 3276
Clickhouse doesn't support writing to ODBC tables yet. (mysql has this functionality). Suppose you have both clickhouse-client and psql on some machine that can reach both <some-ip>
and <another_ip>
. You can achieve this by
clickhouse-client --host <some-ip> --port 8122 --query 'select * from chtable;' | psql -h <another_ip> -p 5437 -c 'copy psqltable from stdin'
Upvotes: 3