# @metwisom/mclickhouse

> Implementing a Clickhouse client over HTTP

Latest version **0.1.4** (published 2022-02-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install @metwisom/mclickhouse
pnpm add @metwisom/mclickhouse
yarn add @metwisom/mclickhouse
bun add @metwisom/mclickhouse
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2022-02-07 |
| First published | 2021-01-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ruslan Timershin |
| Maintainers | metwisom |
| Keywords | clickhouse, database, db, sql, typescript |

## Links

- npm: https://www.npmjs.com/package/@metwisom/mclickhouse
- Repository: https://github.com/metwisom/mClickhouse
- Homepage: https://github.com/metwisom/mClickhouse#readme
- Issues: https://github.com/metwisom/mClickhouse/issues
- npm.io page: https://npm.io/package/@metwisom/mclickhouse

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2022-02-07
- 0.1.3 — 2022-02-04
- 0.1.2 — 2022-02-04
- 0.1.1 — 2021-07-19
- 0.2.0 — 2021-01-20
- 0.1.0 — 2021-01-08

## README

# @metwisom/mclickhouse
NodeJS client for [ClickHouse](https://clickhouse.yandex/).
Send query over HTTP interface.

***
Install:

```bash
npm i @metwisom/mclickhouse
```
***

Example:

```javascript
const { mClickhouse } = require('@metwisom/mclickhouse');

const clickhouse = new mClickhouse();
```


***
 
Exec query:
```javascript
await clickhouse.query(`DROP TABLE IF EXISTS default.test`);
await clickhouse.query(
    `CREATE TABLE default.test (
        data String, 
        some_index UInt32, 
        some_date DateTime('Europe/Moscow')
    ) 
    ENGINE = MergeTree()
    PARTITION BY toYYYYMM(some_date)
    ORDER BY some_index
    SETTINGS index_granularity = 8192`);

const preparedData = Array(10).fill().map(
    () => [getRandomInt(1000), getRandomInt(1000), '2020-01-02 14:28:56']
);

// mono insert
await clickhouse.insert('default.test', preparedData[0]);

// multi insert
await clickhouse.insert('default.test', preparedData);

const res = await clickhouse.query('SELECT * FROM default.test LIMIT 10');
````

***

**Run Tests**:

```
npm install

npm run test
# or verbose mode
npm run testf
```

---
_Source: https://npm.io/package/@metwisom/mclickhouse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
