Loading...
Loading...
Compare original and translation side by side
⚠️ Node.js runtime only. This skill covers thepackage running in a Node.js runtime exclusively — including Next.js Node runtime API routes, React Server Components, Server Actions, and standard Node.js processes. Do not apply this skill to browser client components, Web Workers, Next.js Edge runtime, Cloudflare Workers, or any usage of@clickhouse/client. For browser/edge environments, the correct package is@clickhouse/client-web.@clickhouse/client-web
⚠️ 仅适用于Node.js运行时。本技能仅涵盖在Node.js运行时中运行的包——包括Next.js Node运行时的API路由、React Server Components、Server Actions以及标准Node.js进程。请勿将此技能应用于浏览器客户端组件、Web Workers、Next.js Edge运行时、Cloudflare Workers或任何@clickhouse/client的使用场景。对于浏览器/边缘环境,应使用@clickhouse/client-web包。@clickhouse/client-web
@clickhouse/client@clickhouse/client-webcreateClient({ url })await client.close()JSONEachRowexamples/node/performance/clickhouse_settingscreateClientclickhouse_settingsinsert()query()command()query_paramsreference/query-parameters.mdclient.insert()client.query()resultSet.json().text().stream()client.command()CREATEDROPTRUNCATEALTERSETclient.exec()client.ping(){ success, error? }pathname>= 1.0.0BigIntquery_params>= 1.15.0TupleParamMapquery_params>= 1.9.0json.parsejson.stringify>= 1.14.0TimeTime64>= 25.6DynamicVariantJSON>= 24.124.524.825.3@clickhouse/client@clickhouse/client-webcreateClient({ url })await client.close()JSONEachRowexamples/node/performance/clickhouse_settingscreateClientinsert()query()command()clickhouse_settingsquery_paramsreference/query-parameters.mdclient.insert()client.query()resultSet.json().text().stream()client.command()CREATEDROPTRUNCATEALTERSETclient.exec()client.ping(){ success, error? }pathname>= 1.0.0query_paramsBigInt>= 1.15.0query_paramsTupleParamMap>= 1.9.0json.parsejson.stringify>= 1.14.0TimeTime64>= 25.6DynamicVariantJSON>= 24.124.524.825.3| Task | Triggers / symptoms | Reference file |
|---|---|---|
| Configure / connect the client | Building a | |
| Ping the server | Health checks, readiness probes, "is ClickHouse up?" | |
| Choose an insert format | "Which format should I use to insert?", JSON vs raw, | |
| Insert into a subset of columns / different database | | |
| Insert values, expressions, dates, decimals | | |
| Async inserts (server-side batching) | | |
| Select and parse results | | |
| Parameterize queries | Binding values, special characters / escaping, "SQL injection?", | |
| Sessions & temporary tables | | |
| Modern data types | | |
| Custom JSON parse/stringify | Plug in | |
| 任务 | 触发场景/症状 | 参考文档 |
|---|---|---|
| 配置/连接客户端 | 编写 | |
| Ping服务器 | 健康检查、就绪探针、"ClickHouse是否正常运行?" | |
| 选择插入格式 | "我应该使用哪种格式插入数据?"、JSON与原始格式对比、 | |
| 插入到部分列/不同数据库 | 使用 | |
| 插入值、表达式、日期、小数 | 带SQL函数的 | |
| 异步插入(服务器端批量处理) | 设置 | |
| 查询并解析结果 | 读取 | |
| 参数化查询 | 值绑定、特殊字符/转义、"SQL injection风险?"、 | |
| 会话与临时表 | | |
| 现代数据类型 | | |
| 自定义JSON解析/序列化 | 接入 | |
import { createClient } from '@clickhouse/client'await client.close()format: 'JSONEachRow'values: [...]await (await client.query({...})).json<RowType>(){name: Type}$1?:nameclickhouse_settings: { wait_end_of_query: 1 }command()import { createClient } from '@clickhouse/client'await client.close()format: 'JSONEachRow'values: [...]await (await client.query({...})).json<RowType>(){name: Type}$1?:namecommand()clickhouse_settings: { wait_end_of_query: 1 }@clickhouse/clientECONNRESETclickhouse-js-node-troubleshootingexamples/node/performance/examples/node/security/CREATE TABLEexamples/node/schema-and-deployments/@clickhouse/client-webexamples/web/@clickhouse/clientECONNRESETclickhouse-js-node-troubleshootingexamples/node/performance/examples/node/security/CREATE TABLEexamples/node/schema-and-deployments/@clickhouse/client-webexamples/web/examples/node/coding/examples/node/coding/