Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clickhouse-elixir/clickhousex
Elixir lib to work with ClickHouse database
https://github.com/clickhouse-elixir/clickhousex
Last synced: 30 days ago
JSON representation
Elixir lib to work with ClickHouse database
- Host: GitHub
- URL: https://github.com/clickhouse-elixir/clickhousex
- Owner: clickhouse-elixir
- License: apache-2.0
- Created: 2018-03-23T09:48:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-04T21:23:14.000Z (over 3 years ago)
- Last Synced: 2024-11-07T21:46:28.939Z (about 1 month ago)
- Language: Elixir
- Homepage:
- Size: 250 KB
- Stars: 87
- Watchers: 13
- Forks: 44
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-clickhouse - clickhouse-elixir/clickhousex - Clickhousex is an Elixir library that enables connections to ClickHouse databases via HTTP. (Language bindings / Elixir)
README
# Clickhousex
ClickHouse database driver to connect with Elixir application by HTTP interface.
## Installation
```elixir
def deps do
[
{:clickhousex, "~> 0.4.0"}
]
end
```## Start driver
Call `start_link()/1` function and pass connection options:```elixir
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 | :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## Queries examples
```elixir
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)>
```## Documentation
Documentation can be found [here](https://hexdocs.pm/clickhousex).