ClickHouse
ClickHouse is an open-source, high performance columnar OLAP database management system for real-time analytics using SQL.
Official Websitehttps://clickhouse.com/
TagsDatabaseSQL
JavaScript
Python
NodeJS packagehttps://www.npmjs.com/package/@clickhouse/client
Version0.0.14
Source Codehttps://github.com/ClickHouse/clickhouse-js
Pypi packagehttps://pypi.org/project/clickhouse-connect/
Version0.15.12
Network Connection needs
This integration needs network access to the server where the service is running.
See the Network access page for details about how to achieve that.
Credential configuration
Fill it with the appropiate values for your connection. Fill which you need of: host
, database
, username
and password
.
In the extra options field you can pass any of the params you can find here.
Here you have an example of a filled credential configuration form in YepCode:

ClickHouse snippets available in editor
note
The title is the triggering text for YepCode to autocomplete the script
JavaScript
Python
Integration
New integration from credential
const clickhouse = yepcode.integration.clickhouse('credential-slug')
New integration from plain authentication data
const { createClient } = require('@clickhouse/client')
const clickhouse = createClient({
host: 'https://play-api.clickhouse.com:8123',
username: 'playground',
password: 'clickhouse',
database: 'my_database_name'
})
Execute query
Execute query (promise)
const resultSet = await clickhouse.query({
query: 'SELECT * FROM my_table',
format: 'JSONEachRow',
})
const dataset = await resultSet.json()
console.log(dataset);
Execute query (stream)
const resultSet = await clickhouse.query({
query: 'SELECT number FROM system.numbers_mt LIMIT 5',
format: 'CSV',
})
const stream = resultSet.stream()
stream.on('data', (rows) => {
rows.forEach((row) => {
console.log(row.text)
})
})
await new Promise((resolve) => {
stream.on('end', () => {
console.log('Completed!')
resolve(0)
})
})
Insert
Insert
await clickhouse.insert({
table: 'my_table',
// structure should match the desired format, JSONEachRow in this example
values: [
{ id: 42, name: 'foo' },
{ id: 42, name: 'bar' },
],
format: 'JSONEachRow',
})
Integration
New integration from credential
clickhouse = yepcode.integration.clickhouse('credential-slug')
New integration from plain authentication data
import clickhouse_connect
clickhouse = clickhouse_connect.get_client(
host='https://play-api.clickhouse.com',
port=8123,
username='playground',
password='clickhouse',
database='my_database_name'
)
Execute query
Execute query
result_set = clickhouse.query(query='SELECT * FROM my_table FORMAT JSONEachRow')
dataset = result_set.result_rows
print(dataset)
Execute query (stream)
with clickhouse.query_row_block_stream('SELECT * FROM my_table FORMAT JSONEachRow') as stream:
for block in stream:
for row in block:
print(row)
Insert
Insert
data = [
[42, 'foo'],
[43, 'bar'],
]
clickouse.insert('my_table', data)