clickhouse

ClickHouse client for Crystal
0.1.1 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 '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

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  var:
    github: maiha/clickhouse.cr
    version: 0.1.1
  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

Roadmap

  • Core
    • [x] all primitive DataType
  • Request
    • [ ] output format
  • Response
    • [x] 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.1
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