Module lua_clickhouse

This module contains Clickhouse access functions

Brief content:

Functions:

Function Description
lua_clickhouse.select(upstream, settings, params, query, ok_cb, fail_cb).
lua_clickhouse.select_sync(upstream, settings, params, query, ok_cb, fail_cb, row_cb).
lua_clickhouse.insert(upstream, settings, params, query, rows, ok_cb, fail_cb).
lua_clickhouse.generic(upstream, settings, params, query, ok_cb, fail_cb).
lua_clickhouse.generic_sync(upstream, settings, params, query, ok_cb, fail_cb).

Functions

The module lua_clickhouse defines the following functions.

Function lua_clickhouse.select(upstream, settings, params, query,

  ok_cb, fail_cb) Make select request to clickhouse   * use_gsip: use gzip compression   * timeout: request timeout   * no_ssl_verify: skip SSL verification   * user: HTTP user   * password: HTTP password

Parameters:

  • upstream {upstream}: clickhouse server upstream
  • settings {table}: global settings table:
  • HTTP {params}: request params
  • query {string}: select query (passed in HTTP body)
  • ok_cb {function}: callback to be called in case of success
  • fail_cb {function}: callback to be called in case of some error
  • row_cb {function}: optional callback to be called on each parsed data row (instead of table insertion)

Returns:

  • {boolean}: whether a connection was successful

Example:

--

Back to module description.

Function lua_clickhouse.select_sync(upstream, settings, params, query,

  ok_cb, fail_cb, row_cb) Make select request to clickhouse   * use_gsip: use gzip compression   * timeout: request timeout   * no_ssl_verify: skip SSL verification   * user: HTTP user   * password: HTTP password
     {string} error message if exists
     nil | {rows} | {http_response}

Parameters:

  • upstream {upstream}: clickhouse server upstream
  • settings {table}: global settings table:
  • HTTP {params}: request params
  • query {string}: select query (passed in HTTP body)
  • ok_cb {function}: callback to be called in case of success
  • fail_cb {function}: callback to be called in case of some error
  • row_cb {function}: optional callback to be called on each parsed data row (instead of table insertion)

Returns:

  • no description

Example:

--

Back to module description.

Function lua_clickhouse.insert(upstream, settings, params, query, rows,

  ok_cb, fail_cb) Insert data rows to clickhouse   * use_gsip: use gzip compression   * timeout: request timeout   * no_ssl_verify: skip SSL verification   * user: HTTP user   * password: HTTP password

Parameters:

  • upstream {upstream}: clickhouse server upstream
  • settings {table}: global settings table:
  • HTTP {params}: request params
  • query {string}: select query (passed in query request element with spaces escaped)
  • rows {table|mixed}: mix of strings, numbers or tables (for arrays)
  • ok_cb {function}: callback to be called in case of success
  • fail_cb {function}: callback to be called in case of some error

Returns:

  • {boolean}: whether a connection was successful

Example:

--

Back to module description.

Function lua_clickhouse.generic(upstream, settings, params, query,

  ok_cb, fail_cb) Make a generic request to Clickhouse (e.g. alter)   * use_gsip: use gzip compression   * timeout: request timeout   * no_ssl_verify: skip SSL verification   * user: HTTP user   * password: HTTP password

Parameters:

  • upstream {upstream}: clickhouse server upstream
  • settings {table}: global settings table:
  • HTTP {params}: request params
  • query {string}: Clickhouse query (passed in query request element with spaces escaped)
  • ok_cb {function}: callback to be called in case of success
  • fail_cb {function}: callback to be called in case of some error

Returns:

  • {boolean}: whether a connection was successful

Example:

--

Back to module description.

Function lua_clickhouse.generic_sync(upstream, settings, params, query,

  ok_cb, fail_cb) Make a generic request to Clickhouse (e.g. alter)   * use_gsip: use gzip compression   * timeout: request timeout   * no_ssl_verify: skip SSL verification   * user: HTTP user   * password: HTTP password

Parameters:

  • upstream {upstream}: clickhouse server upstream
  • settings {table}: global settings table:
  • HTTP {params}: request params
  • query {string}: Clickhouse query (passed in query request element with spaces escaped)

Returns:

  • {boolean}: whether a connection was successful

Example:

--

Back to module description.

Back to top.