Inserting and dumping SQL data in ClickHouse
ClickHouse can be easily integrated into OLTP database infrastructures in many ways. One way is to transfer data between other databases and ClickHouse using SQL dumps.
Creating SQL dumps
Data can be dumped in SQL format using SQLInsert. ClickHouse will write data in INSERT INTO <table name> VALUES(. form and use output_format_sql_insert_table_name settings option as a table name:
Column names can be omitted by disabling output_format_sql_insert_include_column_names option:
Now we can feed dump.sql file to another OLTP database:
We assume that the some_table table exists in the some_db MySQL database.
Some DBMSs might have limits on how much values can be processes within a single batch. By default, ClickHouse will create 65k values batches, but that can be changed with the output_format_sql_insert_max_batch_size option:
Exporting a set of values
ClickHouse has Values format, which is similar to SQLInsert, but omits an INSERT INTO table VALUES part and returns only a set of values:
Clickhouse подключение к Oracle DB через clickhouse-jdbc-bridge + ojdbc
Трудно было найти документацию по настройке данного типа подключения. По этому делюсь опытом.
Установку и настройку clickhouse-jdbc-bridge описивать не буду всё прекрасно написано здесь.
Чтобы настроить поключение к базе Oracle создаём JSON файл (у меня dbdwh.json) в папке «config/datasources» наименованием подключение. Где был установлен clickhouse-jdbc-bridge.
Потом на данный файл вставляем настройки.
<
«$schema»: «/etc/clickhouse-jdbc-bridge/config/datasource.jschema»,
«dbdwh»: <
«aliases»: [
«oracle»
],
«driverUrls»: [
«https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc8/19.3.0.0/ojdbc8-19.3.0.0.jar»
],
«jdbcUrl»: «jdbc:oracle:thin:@//11.22.33.44:1521/dbdwh»,
«username»: «test»,
«password»: «test»,
«maximumPoolSize»: «20»,
«connectionTestQuery»: «select * from