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 1, 'foo'")
res.size # => 1
res.to_a # => [[1, "foo"]]
res.each do |vals|
vals # => [1, "foo"]
end
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.0
- 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
TODO
- Core
- [ ] Support all primitive DataType
- Request
- [ ] output format
- Response
- [ ] 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