【问题标题】:Transfer data from clickhouse to PostgreSQL running on different machines将数据从 clickhouse 传输到在不同机器上运行的 PostgreSQL
【发布时间】:2019-03-07 19:00:10
【问题描述】:

我的 clickhouse 数据库在 some_ip:8122 上运行

clickhouse 数据库:

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 数据库在 another_ip:5437 上运行

postgresql 数据库:

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)
);

如何将 clickhouse 数据库中的数据复制到 postgresql 数据库(在不同机器上运行)?

【问题讨论】:

    标签: postgresql pipe clickhouse


    【解决方案1】:

    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'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多