All Projects → roistat → Go Clickhouse

roistat / Go Clickhouse

Licence: mit
Golang ClickHouse connector

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Clickhouse

Clickhouse.client
.NET client for ClickHouse
Stars: ✭ 85 (-51.15%)
Mutual labels:  clickhouse, client
twitter-for-geoevent
ArcGIS GeoEvent Server sample Twitter connectors for sending and receiving tweets.
Stars: ✭ 21 (-87.93%)
Mutual labels:  adapter, connector
Shackle
High-Performance Erlang Network Client Framework
Stars: ✭ 163 (-6.32%)
Mutual labels:  client
Rom Sql
SQL support for rom-rb
Stars: ✭ 169 (-2.87%)
Mutual labels:  adapter
Bt
BitTorrent library and client with DHT, magnet links, encryption and more
Stars: ✭ 2,011 (+1055.75%)
Mutual labels:  client
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-5.75%)
Mutual labels:  client
Objcmongodb
Mac OS and iOS library for MongoDB and BSON
Stars: ✭ 166 (-4.6%)
Mutual labels:  client
Remotemonitor
本项目是一个利用HslCommunication组件读取PLC的示例项目,演示了后台从PLC循环读取到前台显示,并推送给在线客户端,客户端同步显示并画实时曲线图。支持web端同步的数据显示,支持web端远程操作PLC,安卓端数据显示,远程操作PLC
Stars: ✭ 160 (-8.05%)
Mutual labels:  client
Beefun Pro
Github client for iOS in Swift.
Stars: ✭ 172 (-1.15%)
Mutual labels:  client
Azure Cosmosdb Spark
Apache Spark Connector for Azure Cosmos DB
Stars: ✭ 165 (-5.17%)
Mutual labels:  connector
Clickhouse Sqlalchemy
ClickHouse dialect for SQLAlchemy
Stars: ✭ 166 (-4.6%)
Mutual labels:  clickhouse
Flink Clickhouse Sink
Flink sink for Clickhouse
Stars: ✭ 165 (-5.17%)
Mutual labels:  clickhouse
Unity Fastpacedmultiplayer
Features a Networking Framework to be used on top of Unity Networking, in order to implement an Authoritative Server with Lag Compensation, Client-Side Prediction/Server Reconciliation and Entity Interpolation
Stars: ✭ 162 (-6.9%)
Mutual labels:  client
Redis Adapter
Redis adapter for Casbin
Stars: ✭ 167 (-4.02%)
Mutual labels:  adapter
Xmpp.js
XMPP for JavaScript
Stars: ✭ 2,006 (+1052.87%)
Mutual labels:  client
Vectorsql
VectorSQL is a free analytics DBMS for IoT & Big Data, compatible with ClickHouse.
Stars: ✭ 171 (-1.72%)
Mutual labels:  clickhouse
Pysnow
Python library for the ServiceNow REST API
Stars: ✭ 162 (-6.9%)
Mutual labels:  client
Swiftyinsta
Instagram Private API Swift
Stars: ✭ 165 (-5.17%)
Mutual labels:  client
Blocks.js
JavaScript dataflow graph editor
Stars: ✭ 165 (-5.17%)
Mutual labels:  connector
Earth Reverse Engineering
Reversing Google's 3D satellite mode
Stars: ✭ 2,083 (+1097.13%)
Mutual labels:  client

go-clickhouse

Travis status Coverage Status Go Report

Golang Yandex ClickHouse connector

ClickHouse manages extremely large volumes of data in a stable and sustainable manner. It currently powers Yandex.Metrica, world’s second largest web analytics platform, with over 13 trillion database records and over 20 billion events a day, generating customized reports on-the-fly, directly from non-aggregated data. This system was successfully implemented at CERN’s LHCb experiment to store and process metadata on 10bn events with over 1000 attributes per event registered in 2011.

Examples

Query rows

conn := clickhouse.NewConn("localhost:8123", clickhouse.NewHttpTransport())
query := clickhouse.NewQuery("SELECT name, date FROM clicks")
iter := query.Iter(conn)
var (
    name string
    date string
)
for iter.Scan(&name, &date) {
    //
}
if iter.Error() != nil {
    log.Panicln(iter.Error())
}

Single insert

conn := clickhouse.NewConn("localhost:8123", clickhouse.NewHttpTransport())
query, err := clickhouse.BuildInsert("clicks",
    clickhouse.Columns{"name", "date", "sourceip"},
    clickhouse.Row{"Test name", "2016-01-01 21:01:01", clickhouse.Func{"IPv4StringToNum", "192.0.2.192"}},
)
if err == nil {
    err = query.Exec(conn)
    if err == nil {
        //
    }
}

External data for query processing

See documentation for details

conn := clickhouse.NewConn("localhost:8123", clickhouse.NewHttpTransport())
query := clickhouse.NewQuery("SELECT Num, Name FROM extdata")
query.AddExternal("extdata", "Num UInt32, Name String", []byte("1	first\n2	second")) // tab separated


iter := query.Iter(conn)
var (
    num  int
    name string
)
for iter.Scan(&num, &name) {
    //
}
if iter.Error() != nil {
    log.Panicln(iter.Error())
}

Cluster

Cluster is useful if you have several servers with same Distributed table (master). In this case you can send requests to random master to balance load.

  • cluster.Check() pings all connections and filters active ones
  • cluster.ActiveConn() returns random active connection
  • cluster.OnCheckError() is called when any connection fails

Important: You should call method Check() at least once after initialization, but we recommend to call it continuously, so ActiveConn() will always return filtered active connection.

http := clickhouse.NewHttpTransport()
conn1 := clickhouse.NewConn("host1", http)
conn2 := clickhouse.NewConn("host2", http)

cluster := clickhouse.NewCluster(conn1, conn2)
cluster.OnCheckError(func (c *clickhouse.Conn) {
    log.Fatalf("Clickhouse connection failed %s", c.Host)
})
// Ping connections every second
go func() {
    for {
        cluster.Check()
        time.Sleep(time.Second)
    }
}()

Transport options

Timeout

t := clickhouse.NewHttpTransport()
t.Timeout = time.Second * 5

conn := clickhouse.NewConn("host", t)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].