View Source Ch (Ch v0.1.14)

Minimal HTTP ClickHouse client.

Link to this section Summary

Functions

Returns a supervisor child specification for a DBConnection pool.

Runs a query and returns the result as {:ok, %Ch.Result{}} or {:error, Exception.t()} if there was a database error.

Runs a query and returns the result or raises Ch.Error if there was an error. See query/4.

Start the connection process and connect to ClickHouse.

Link to this section Functions

Returns a supervisor child specification for a DBConnection pool.

Link to this function

query(conn, statement, params \\ [], opts \\ [])

View Source
@spec query(DBConnection.conn(), iodata(), params, Keyword.t()) ::
  {:ok, Ch.Result.t()} | {:error, Exception.t()}
when params: map() | [term()] | [row :: [term()]] | iodata() | Enumerable.t()

Runs a query and returns the result as {:ok, %Ch.Result{}} or {:error, Exception.t()} if there was a database error.

options

Options

  • :timeout - Query request timeout
  • :settings - Keyword list of settings
  • :database - Database
  • :username - Username
  • :password - User password
Link to this function

query!(conn, statement, params \\ [], opts \\ [])

View Source
@spec query!(DBConnection.conn(), iodata(), params, Keyword.t()) :: Ch.Result.t()
when params: map() | [term()] | [row :: [term()]] | iodata() | Enumerable.t()

Runs a query and returns the result or raises Ch.Error if there was an error. See query/4.

Start the connection process and connect to ClickHouse.

options

Options

  • :hostname - server hostname, defaults to "localhost"
  • :port - HTTP port, defualts to 8123
  • :scheme - HTTP scheme, defaults to "http"
  • :database - Database, defaults to "default"
  • :username - Username
  • :password - User password
  • :settings - Keyword list of ClickHouse settings
  • :timeout - HTTP receive timeout in milliseconds
  • :transport_opts - options to be given to the transport being used. See Mint.HTTP1.connect/4 for more info