Skip to content

metrico/clickhouse-node-url-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ClickHouse NodeJS URL Engine

This basic example illustrates a simple NodeJS URL Table Engine server for Clickhouse

⏱️ Why

Clickhouse is super fast and already has all the functions one could dream. What is this for?

This example is designed to understand the underlying formats and unleash imagination for integrators.

sequenceDiagram
    autonumber
    ClickHouse->>NodeJS: POST Request
    loop Javascript
        NodeJS->>NodeJS: INSERT
    end
    NodeJS-->>ClickHouse: POST Response
    ClickHouse->>NodeJS: GET Request
    loop Javascript
        NodeJS->>NodeJS: SELECT
    end
    NodeJS-->>ClickHouse: GET Response
Loading
Features
  • INSERT to JS array
  • SELECT from JS array

Setup

Install and run the example service :

npm install
npm start

📦 Clickhouse

Create a url_engine_table table pointed at our service :

CREATE TABLE url_engine_node
(
    `key` String,
    `value` UInt64
)
ENGINE = URL('http://127.0.0.1:3123/', JSONEachRow)
▶️ INSERT
INSERT INTO url_engine_node VALUES ('hello',1), ('world', 2)
◀️ SELECT
SELECT * FROM url_engine_node

Query id: d65b429e-76aa-49f3-b376-ebd3fbc9cd1a

┌─key───┬─value─┐
│ hello │     1 │
│ world │     2 │
└───────┴───────┘

2 rows in set. Elapsed: 0.005 sec. 

About

Example NodeJS URL Engine for Clickhouse

Topics

Resources

License

Stars

Watchers

Forks