clickhouse
clickhouse.cr 
ClickHouse client for Crystal
Usage
Clickhouse#execute
returns a Clickhouse::Response
which includes Enumerable(Array(Type))
.
require "clickhouse"
client = Clickhouse.new(host: "localhost", port: 8123)
res = client.execute("SELECT 'foo', 2")
res.to_a # => [["foo", 2]]
res.rows # => 1
res.statistics.elapsed # => 0.000671276
res.statistics.rows_read # => 1
res.statistics.bytes_read # => 1
res.scalar # => "foo"
Available DataType
- ClickHouse : src/clickhouse/data_type.cr
Installation
- Add the dependency to your
shard.yml
:
dependencies:
var:
github: maiha/clickhouse.cr
version: 0.1.1
- Run
shards install
Development
make test
Add a new DataType
- src/clickhouse/data_type.cr Define ClickHouse DataType
- src/clickhouse.cr Add corresponding Crystal class into
Clickhouse::Type
- src/clickhouse/cast.cr Add logic to combine them
Roadmap
- Core
- [x] all primitive DataType
- Request
- [ ] output format
- Response
- [x] statistics methods
- [ ] fetch value by field name
Contributing
- Fork it (https://github.com/maiha/clickhouse.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- maiha - creator and maintainer