Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metrico/clickhouse-node-url-engine
Example NodeJS URL Engine for Clickhouse
https://github.com/metrico/clickhouse-node-url-engine
clickhouse example insert node select server url-engine
Last synced: about 6 hours ago
JSON representation
Example NodeJS URL Engine for Clickhouse
- Host: GitHub
- URL: https://github.com/metrico/clickhouse-node-url-engine
- Owner: metrico
- License: mit
- Created: 2022-02-19T22:27:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-21T10:02:09.000Z (over 2 years ago)
- Last Synced: 2023-03-06T03:30:02.898Z (over 1 year ago)
- Topics: clickhouse, example, insert, node, select, server, url-engine
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ClickHouse NodeJS URL Engine
This basic example illustrates a simple NodeJS [URL Table Engine](https://clickhouse.com/docs/en/engines/table-engines/special/url/) 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.
```mermaid
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
```##### Features
- [x] INSERT to JS array
- [x] 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 :
```sql
CREATE TABLE url_engine_node
(
`key` String,
`value` UInt64
)
ENGINE = URL('http://127.0.0.1:3123/', JSONEachRow)
```
##### βΆοΈ INSERT
```sql
INSERT INTO url_engine_node VALUES ('hello',1), ('world', 2)
```
##### βοΈ SELECT
```sql
SELECT * FROM url_engine_nodeQuery id: d65b429e-76aa-49f3-b376-ebd3fbc9cd1a
ββkeyββββ¬βvalueββ
β hello β 1 β
β world β 2 β
βββββββββ΄ββββββββ2 rows in set. Elapsed: 0.005 sec.
```