Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@clickhouse/client
Advanced tools
@clickhouse/client is an npm package that provides a client for interacting with ClickHouse, a columnar database management system. It allows you to perform various database operations such as querying, inserting data, and managing database schemas.
Querying Data
This feature allows you to execute SQL queries against a ClickHouse database. The code sample demonstrates how to create a client instance and perform a SELECT query.
const { ClickHouse } = require('@clickhouse/client');
const client = new ClickHouse({
url: 'http://localhost:8123',
basicAuth: {
username: 'default',
password: '',
},
});
async function queryData() {
const rows = await client.query('SELECT * FROM my_table').toPromise();
console.log(rows);
}
queryData();
Inserting Data
This feature allows you to insert data into a ClickHouse table. The code sample demonstrates how to create a client instance and perform an INSERT operation.
const { ClickHouse } = require('@clickhouse/client');
const client = new ClickHouse({
url: 'http://localhost:8123',
basicAuth: {
username: 'default',
password: '',
},
});
async function insertData() {
const result = await client.insert('INSERT INTO my_table (column1, column2) VALUES', [
[1, 'value1'],
[2, 'value2'],
]).toPromise();
console.log(result);
}
insertData();
Managing Database Schemas
This feature allows you to manage database schemas, such as creating or altering tables. The code sample demonstrates how to create a new table in a ClickHouse database.
const { ClickHouse } = require('@clickhouse/client');
const client = new ClickHouse({
url: 'http://localhost:8123',
basicAuth: {
username: 'default',
password: '',
},
});
async function createTable() {
const result = await client.query(`
CREATE TABLE IF NOT EXISTS my_table (
id UInt32,
name String
) ENGINE = MergeTree()
ORDER BY id
`).toPromise();
console.log(result);
}
createTable();
The 'clickhouse' npm package is another client for interacting with ClickHouse databases. It offers similar functionalities such as querying and inserting data, but may have different API conventions and additional features.
The 'node-clickhouse' npm package is a client for ClickHouse that supports both HTTP and native protocols. It offers comprehensive functionalities for interacting with ClickHouse databases, including querying, inserting, and managing schemas.
Official JS client for ClickHouse, written purely in TypeScript, thoroughly tested with actual ClickHouse versions.
The repository consists of three packages:
@clickhouse/client
- a version of the client designed for Node.js platform only. It is built on top of HTTP
and Stream APIs; supports streaming for both selects and inserts.@clickhouse/client-web
- a version of the client built on top of Fetch
and Web Streams APIs; supports streaming for selects.
Compatible with Chrome/Firefox browsers and CloudFlare workers.@clickhouse/client-common
- shared common types and the base framework for building a custom client implementation.See the ClickHouse website for the full documentation entry.
We have a wide range of examples, aiming to cover various scenarios of client usage. The overview is available in the examples README.
If you have any questions or need help, feel free to reach out to us in the Community Slack (#clickhouse-js
channel) or via GitHub issues.
Check out our contributing guide.
1.8.1 (Node.js)
FAQs
Official JS client for ClickHouse DB - Node.js implementation
The npm package @clickhouse/client receives a total of 468,153 weekly downloads. As such, @clickhouse/client popularity was classified as popular.
We found that @clickhouse/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.