clickhouse-crystal

Version, currently master branch1 version
  • master branchlatestFeb 1, 2019

github.com/trendier-ai/clickhouse-crystal

clickhouse driver for crystal lang

7 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  clickhouse-crystal:
    github: trendier-ai/clickhouse-crystal
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.22.0
License
MIT
Author
metacortex <0@measurechina.io>

Dependencies

This version declares no dependencies.

README

# clickhouse-crystal

clickhouse for crystal-lang

## Installation

Add this to your application's `shard.yml`:

```yaml
dependencies:
  clickhouse-crystal:
    github: measurechina/clickhouse-crystal
```

## Usage

```crystal
require "clickhouse-crystal"


# init
client = Clickhouse.connect({
  "host" => "localhost",
  "port" => "8123",
  "database" => "sensors",
})

# insert
body = [
  {
    table: "test_db.sensors",
    columns: %w(uid name date),
    data: [
      [11, "son", "2017-03-01 11:12:13"],
      [22, "park", Time.now.to_s("%F %X")],
    ],
  },
]

result = client.insert!(body)

# query
query = client.query("SELECT COUNT(1) FROM sensors")
response = query.execute!

query = client.query("SELECT * FROM sensors;")
response = query.execute!


```


## Contributors
- metacortex - creator, maintainer