Class ClickHouseClient

Hierarchy

  • ClickHouseClient<Stream.Readable>
    • ClickHouseClient

Constructors

Methods

Constructors

Methods

  • Shuts down the underlying connection. This method should ideally be called only once per application lifecycle, for example, during the graceful shutdown phase.

    Returns Promise<void>

  • It should be used for statements that do not have any output, when the format clause is not applicable, or when you are not interested in the response at all. Response stream is destroyed immediately as we do not expect useful information there. Examples of such statements are DDLs or custom inserts.

    Parameters

    Returns Promise<CommandResult>

    Note

    if you have a custom query that does not work with ClickHouseClient.query, and you are interested in the response data, consider using ClickHouseClient.exec.

  • Similar to ClickHouseClient.command, but for the cases where the output is expected, but format clause is not applicable. The caller of this method must consume the stream, as the underlying socket will not be released until then, and the request will eventually be timed out.

    Parameters

    • params: ExecParams | ExecParamsWithValues<Readable>

    Returns Promise<ExecResult<Readable>>

    Note

    it is not intended to use this method to execute the DDLs, such as CREATE TABLE or similar; use ClickHouseClient.command instead.

  • The primary method for data insertion. It is recommended to avoid arrays in case of large inserts to reduce application memory consumption and consider streaming for most of such use cases. As the insert operation does not provide any output, the response stream is immediately destroyed.

    Type Parameters

    • T

    Parameters

    Returns Promise<InsertResult>

    Note

    in case of a custom insert operation (e.g., INSERT FROM SELECT), consider using ClickHouseClient.command, passing the entire raw query there (including the FORMAT clause).

  • Health-check request. It does not throw if an error occurs - the error is returned inside the result object.

    Returns Promise<ConnPingResult>

  • Type Parameters

    Parameters

    • params: QueryParamsWithFormat<Format>

    Returns Promise<QueryResult<Format>>

Generated using TypeDoc