我的点击屋数据库在some_ip:8122
上运行
点击之家数据库:
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);
我的 postgresql db 运行在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)
);
如何将数据从点击室数据库复制到postgresql db(在不同的机器上运行(?
Clickhouse 尚不支持写入 ODBC 表。(MySQL具有此功能(。假设您在某台可以同时访问<some-ip>
和<another_ip>
的计算机上同时具有 clickhouse-client 和 psql。您可以通过以下方式实现此目的
clickhouse-client --host <some-ip> --port 8122 --query 'select * from chtable;' | psql -h <another_ip> -p 5437 -c 'copy psqltable from stdin'