Skip to content

Instantly share code, notes, and snippets.

View filimonov's full-sized avatar

filimonov filimonov

View GitHub Profile
Как настроить Tableau over ClickHouse ODBC на Windows
==== ODBC-драйвер для Clickhouse
1. Надо поставить драйвер https://github.com/yandex/clickhouse-odbc/releases/latest
2. Создать источник данных odbc. Пример:
https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-configuration-dsn-windows-5-2.html
Надо выбрать Unicode версию odbc-драйвера
wget https://clickhouse-datasets.s3.yandex.net/hits/tsv/hits_v1.tsv.xz
wget https://clickhouse-datasets.s3.yandex.net/visits/tsv/visits_v1.tsv.xz
xz -v -d hits_v1.tsv.xz
xz -v -d visits_v1.tsv.xz
clickhouse-client
CREATE TABLE test.hits ( WatchID UInt64, JavaEnable UInt8, Title String, GoodEvent Int16, EventTime DateTime, EventDate Date, CounterID UInt32, ClientIP UInt32, ClientIP6 FixedString(16), RegionID UInt32, UserID UInt64, CounterClass Int8, OS UInt8, UserAgent UInt8, URL String, Referer String, URLDomain String, RefererDomain String, Refresh UInt8, IsRobot UInt8, RefererCategories Array(UInt16), URLCategories Array(UInt16), URLRegions Array(UInt32), RefererRegions Array(UInt32), ResolutionWidth UInt16, ResolutionHeight UInt16, ResolutionDepth UInt8, FlashMajor UInt8, FlashMinor UInt8, FlashMinor2 String, NetMajor UInt8, NetMinor UInt8, UserAgentMajor UInt16, UserAgentMinor FixedString(2), CookieEnable UInt8, JavascriptEnable UInt8, IsMobile UInt8, MobilePhone UI
:) CREATE TABLE test.sessions (begin DateTime, end DateTime) ENGINE = Memory
CREATE TABLE test.sessions
(
begin DateTime,
end DateTime
) ENGINE = Memory
Ok.
@simpl1g
simpl1g / kafka
Last active August 6, 2019 06:35
clichouse-kafka
select count(1) from dummy_buf => 0
kafkacat -b kafka_brokers -t dummy -P
{"ad_type":1}
select count(1) from dummy_buf => 1
...
select count(1) from dummy_buf => 200
@kmatt
kmatt / clickhouse-server.init
Last active October 24, 2019 09:46
Clickhouse init script for CentOS
#!/bin/sh
### BEGIN INIT INFO
# Provides: clickhouse-server
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Required-Start:
# Required-Stop:
# Short-Description: Yandex clickhouse-server daemon
### END INIT INFO
@javisantana
javisantana / compile clickhouse on mojave.md
Last active March 11, 2020 05:45
compile clickhouse on mojave

clickhouse on osx

These are the steps I followed to compile clickhouse on OSX mojave (10.4.3). These might not be the best way to make it compile on OSX, my knowledge about C++ and build tooling is really limited but they do the work.

clickhouse sha-1: 2ad4df1d6a

compile command (apply the patch below before running cmake)

#!/usr/bin/env -S PYTHONHASHSEED=0 python3
# Highlight kafka debug logs:
#
# kafka debug cgrp,consumer,topic,protocol
#
# Usage example:
#
# kafkalog.py < kafka.log | less -R
#!/bin/bash
set -e
rm -rf {cumulative,histograms,stats,metric-names}.{tsv,png} histogram-*.png ||:
clickhouse-local --query "
-- leave only statistically significant changes of metrics of sufficient magnitude
create view metric_stats_filtered as
select *
from file('report/query-metric-stats.tsv', TSVWithNamesAndTypes,
@alexey-milovidov
alexey-milovidov / rank.txt
Created July 22, 2016 00:03
Example of emulation of rank function with arrayEnumerateUniq.
milovidov@milovidov-xenial:~$ clickhouse-client
ClickHouse client version 1.1.53996.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.53996.
:) CREATE TABLE IF NOT EXISTS `employee` (
:-] `empid` Int32,
:-] `deptid` Int32,
:-] `salary` Int64
:-] ) ENGINE = Memory;
+ - сделано хотя бы в master
* - в процессе
Доработки форматов.
+ Protobuf
+ Parquet
+ Avro
+ Настраиваемое поведение CSV: separator.