Clickhousex

与 ClickHouse 数据库一起工作的 Elixir 库。「Elixir lib to work with ClickHouse database」

  • Owner: clickhouse-elixir/clickhousex
  • Platform: BSD, Linux, Mac, Windows
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Clickhousex

ClickHouse 数据库驱动程序通过 HTTP 接口与 Elixir 应用程序连接。

安装

def deps do
  [
    {:clickhousex, "~> 0.4.0"}
  ]
end

启用驱动程序

调用 start_link()/1 函数并传递连接选项:

Clickhousex.start_link(
  scheme:   :http,
  hostname: "localhost",
  port:     8123,
  database: "default",
  username: "user",
  password: "654321"
)

选项要求关键字列表包含零个或多个:

  * `scheme` - Scheme (:http | :https). Default value: :http
  * `hostname` - The server hostname. Default value: "localhost"
  * `database` - Database name. Default value: "default"
  * `port` - The server port number. Default value: 8123
  * `username` - Username. Default value: nil
  * `password` - User's password. Default value: nil

示例查询

iex(1)> {:ok, pid} = Clickhousex.start_link(scheme: :http, hostname: "localhost", port: 8123, database: "system")
{:ok, #PID<0.195.0>}
iex(2)> Clickhousex.query(pid, "SHOW TABLES", [])
{:ok, %Clickhousex.Query{columns: nil, name: "", statement: "SHOW TABLES"},
 %Clickhousex.Result{columns: ["name"], command: :selected, num_rows: 23,
  rows: [["asynchronous_metrics"], ["build_options"], ["clusters"], ["columns"],
   ["databases"], ["dictionaries"], ["events"], ["functions"],
   ["graphite_retentions"], ["merges"], ["metrics"], ["models"], ["numbers"],
   ["numbers_mt"], ["one"], ["parts"], ["parts_columns"], ["processes"],
   ["replicas"], ["replication_queue"], ["settings"], ["tables"],
   ["zookeeper"]]}}
iex(3)>

文档

文档在这里


Main metrics

Overview
Name With Ownerclickhouse-elixir/clickhousex
Primary LanguageElixir
Program languageElixir (Language Count: 1)
PlatformBSD, Linux, Mac, Windows
License:Apache License 2.0
所有者活动
Created At2018-03-23 09:48:47
Pushed At2021-08-04 21:23:14
Last Commit At2021-08-05 00:22:44
Release Count1
Last Release Name0.5.0 (Posted on )
First Release Name0.5.0 (Posted on )
用户参与
Stargazers Count89
Watchers Count12
Fork Count44
Commits Count125
Has Issues Enabled
Issues Count21
Issue Open Count10
Pull Requests Count20
Pull Requests Open Count0
Pull Requests Close Count5
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Clickhousex

ClickHouse database driver to connect with Elixir application by HTTP interface.

Installation

def deps do
  [
    {:clickhousex, "~> 0.4.0"}
  ]
end

Start driver

Call start_link()/1 function and pass connection options:

Clickhousex.start_link(
  scheme:   :http,
  hostname: "localhost",
  port:     8123,
  database: "default",
  username: "user",
  password: "654321"
)

Options expects a keyword list with zero or more of:

  * `scheme` - Scheme (:http