clickhouse

command
v0.2.0-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Example integration with ClickHouse

Run docker image ClickHouse database

$ mkdir $HOME/some_clickhouse_database
$ docker run -d -p 18123:8123 -p19000:9000 -p19090:9090 --name some-clickhouse-server --ulimit nofile=262144:262144 --volume=$HOME/some_clickhouse_database:/var/lib/clickhouse yandex/clickhouse-server 

Then create database and table

CREATE DATABASE develop;

CREATE TABLE IF NOT EXISTS events (
	eid UInt32,
	ip String,
	etype UInt32 default 0,
	price UInt64 default 0,
	created DATETIME default now()
)
ENGINE = MergeTree()
ORDER BY created
;

INSERT INTO events (eid, ip, etype, price, created)
VALUES
	(1, '192.168.1.1', 100, 1000000, '2022-10-01 12:00:00'),
	(2, '127.0.0.1', 100, 1000000, '2022-10-02 12:00:00'),
	(3, '192.168.1.1', 100, 1000000, '2022-10-03 12:00:00'),
	(4, '127.0.0.1', 200, 1000000, '2022-10-01 12:00:00'),
	(5, '192.168.1.1', 200, 1000000, '2022-10-02 12:00:00'),
	(6, '127.0.0.1', 200, 1000000, '2022-10-03 12:00:00'),
	(7, '192.168.1.1', 300, 1000000, '2022-10-01 12:00:00'),
	(8, '127.0.0.1', 300, 1000000, '2022-10-02 12:00:00'),
	(9, '192.168.1.1', 300, 1000000, '2022-10-04 12:00:00')
;

Run example

go run examples/clickhouse/main.go 

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL