Как перенести таблицу oracle в clickhouse

от admin

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

where rownum<1″
>
>

«jdbcUrl»: «jdbc:oracle:thin:@//11.22.33.44:1521/dbdwh», — /dbdwh — не забудте указать схему подключение.

Как перенести таблицу oracle в clickhouse

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML.

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

digitalist/chq

  • 8123 (http-протокол),
  • 9000 (бинарный протокол).
  • не вставлять меньше чем 1000 строк. Ни 10, ни 20, не меньше 1к.
  • вставлять не часто, не чаще 1 раза в секунду, в один поток.
  • Лучше увеличить размер батча, чем иметь больше одного потока вставки.

curl -H «Content-Type: application/json» -X POST -d ‘insert into table_name FORMAT JSONEachRow ‘ http://default:psw@localhost:8123/?input_format_skip_unknown_fields=1

DB::Exception: Element of set in IN or VALUES is not a constant expression

  • Через словарь и getDict. [Vasilij Abrosimov]

ANY INNER JOIN (SELECT id, url FROM urls2 WHERE USING id [Tima Ber] или ANY INNER JOIN (SELECT id, count() AS shows FROM urls2 WHERE day = today) USING (id) [Shegloff]

[Alexey Sheglov / @Shegloff]:

еще такой изврат есть: SELECT arrayJoin(one_arr) AS res, any(two_arr) AS two_arr FROM ( SELECT [1, 2, 3, 4, 5] AS one_arr, [3, 4, 5, 6, 7, 8] AS two_arr ) GROUP BY res HAVING has(two_arr, res) = 0

Name already in use

ClickHouse / docs / en / engines / table-engines / integrations / s3.md

  • Go to file T
  • Go to line L
  • Copy path
  • Copy permalink
  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents

Copy raw contents

Copy raw contents

S3 Table Engine

This engine provides integration with Amazon S3 ecosystem. This engine is similar to the HDFS engine, but provides S3-specific features.

Engine parameters

  • path — Bucket url with path to file. Supports following wildcards in readonly mode: * , ? , and where N , M — numbers, ‘abc’ , ‘def’ — strings. For more information see below.
  • format — The format of the file.
  • aws_access_key_id , aws_secret_access_key — Long-term credentials for the AWS account user. You can use these to authenticate your requests. Parameter is optional. If credentials are not specified, they are used from the configuration file. For more information see Using S3 for Data Storage.
  • compression — Compression type. Supported values: none , gzip/gz , brotli/br , xz/LZMA , zstd/zst . Parameter is optional. By default, it will autodetect compression by file extension.

PARTITION BY — Optional. In most cases you don’t need a partition key, and if it is needed you generally don’t need a partition key more granular than by month. Partitioning does not speed up queries (in contrast to the ORDER BY expression). You should never use too granular partitioning. Don’t partition your data by client identifiers or names (instead, make client identifier or name the first column in the ORDER BY expression).

For partitioning by month, use the toYYYYMM(date_column) expression, where date_column is a column with a date of the type Date. The partition names here have the «YYYYMM» format.

Example

  • _path — Path to the file.
  • _file — Name of the file.

For more information about virtual columns see here.