GitHub

API reference for driver.

The client of ClickHouse's HTTP interface that ClickhouseClient runs on (@clickhouse/client's ClickHouseClient), sending its requests with a pyfect HttpClient.

Every method is an effect: interrupting it aborts its request (the server may still run the query; ClickhouseClient kills it). Failures are a ClickhouseError for what the server answered and an HttpClientError for a request that got no answer.

  • query: a statement with output, FORMAT <format> appended (JSON by default); its ResultSet reads the body
  • command: a statement without output (DDL); the body is drained
  • exec: a statement as written (its own FORMAT), its body unread
  • insert: rows into a table, encoded for format
  • ping: the /ping endpoint, which checks no credentials

Values

AttributeTypeDescription
STREAMABLE_JSON_FORMATSfrozenset[str]

Formats with one JSON value per line.

SINGLE_DOCUMENT_JSON_FORMATSfrozenset[str]

Formats whose whole body is one JSON document.

MAX_URL_BIND_PARAM_LENGTHLiteral[4096] = 4096

How long a query's parameters may make the URL under use_multipart_params_auto before they go in a multipart body.

Types

TypeDefinitionDescription
ClickhouseRequestErrortype ClickhouseRequestError = ClickhouseError | HttpClientError

How a request fails: the server's error, or no answer.

DataFormattype DataFormat = str

A ClickHouse format name (JSON, JSONEachRow, CSV, ...).

InsertValuestype InsertValues = Sequence[object] | Mapping[str, object] | bytes | str | Stream[Any, object]

What insert sends: rows (each JSON-encoded on its own line), one JSON document (JSON, JSONObjectEachRow), a body already in format (bytes / str), or a stream of rows (JSON formats) or of bytes (any other format).

InsertColumnstype InsertColumns = Sequence[str] | Mapping[Literal['except'], Sequence[str]]

The columns an insert sets: ["a", "b"], or {"except": ["id"]}.

Classes