clickhouse

ClickHouse client for Crystal
0.1.0 released

clickhouse.cr Build Status

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

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  var:
    github: maiha/clickhouse.cr
    version: 0.1.0
  1. Run shards install

Development

make test

Add a new DataType

  1. src/clickhouse/data_type.cr Define ClickHouse DataType
  2. src/clickhouse.cr Add corresponding Crystal class into Clickhouse::Type
  3. 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

  1. Fork it (https://github.com/maiha/clickhouse.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • maiha - creator and maintainer
clickhouse:
  github: confact/clickhouse.cr
  version: ~> 0.1.0
License MIT
Crystal 0.27.0

Authors

Dependencies 2

  • jq >= 0.7.0
    {'github' => 'maiha/jq.cr', 'version' => '>= 0.7.0'}
  • var >= 1.2.0
    {'github' => 'maiha/var.cr', 'version' => '>= 1.2.0'}

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently