clickhouse-crystal

clickhouse driver for crystal lang

clickhouse-crystal

clickhouse for crystal-lang

Installation

Add this to your application's shard.yml:

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

Usage

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
Repository

clickhouse-crystal

Owner
Statistic
  • 6
  • 3
  • 1
  • 0
  • 0
  • almost 6 years ago
  • April 28, 2017
License

MIT License

Links
Synced at

Sat, 21 Dec 2024 15:31:18 GMT

Languages