Questions tagged [clickhouse]

ClickHouse is an open-source column-oriented DBMS for real time analytical reporting which has Capability to store and process petabytes of data.

ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real time.

1835 questions
4
votes
2 answers

Clickhouse: Reduce Array of Tuples to calculate average session time

I have array of events. Each event represented as tuple and contain session_id and datetime: [ ('aa', '2020-11-08 01:00:01'), ('aa', '2020-11-08 01:00:03'), ('aa', '2020-11-08 01:00:05'), ('ab', '2020-11-09 01:00:00'), ('ab', '2020-11-09…
nikopol
  • 41
  • 3
4
votes
1 answer

Python clickhouse-driver: ValueError: Parameters are expected in dict form

I have some ETL that saves data to clickhouse with clickhouse-driver. Save function looks exactly like this: def insert_data(data: Iterable[Dict], table: str, client: Client = None): columns = get_table_cols(table) client = client or…
go2nirvana
  • 1,598
  • 11
  • 20
4
votes
5 answers

How to sum the values of a column for several rows?

I have this table, and I want to add the values of 'change' column for several rows (Or, to be more exact from the row in which 'ne' value is zero up to the next row which includes zero for 'ne' (not the second one itself)). Any answer would be…
Commander
  • 311
  • 3
  • 16
4
votes
1 answer

Clickhouse - "Too many partitions for single INSERT block"

During a reload of a replicated MySQL database to Clickhouse, using "clickhouse-mysql" I run into the "Too many partitions for single INSERT block" and I seem unable to progress. So far, some of the things I've tried: setting…
questionmark
  • 147
  • 1
  • 2
  • 5
4
votes
2 answers

New to ClickHouse, can't create local host

I'm new to clickhouse and trying to get started. I've installed all the packages needed to be able to use it on my computer (ubuntu 16.04) but when I use the clickhouse-client command I get the following: ClickHouse client version 20.3.4.10…
qer
  • 73
  • 2
  • 10
4
votes
1 answer

Why is "Cannot modify setting in readonly mode" thrown when not explicitly modify it in ClickHouse?

Applications were using readonly user when the following exception was thrown: HTTPHandler: Code: 164, e.displayText() = DB::Exception: Cannot modify 'result_overflow_mode' setting in readonly mode I read ClickHouse code and found that when…
Winter Z.
  • 73
  • 1
  • 13
4
votes
1 answer

How can I write spark Dataframe to clickhouse

val df = spark.read.parquet(path) val IP ="190.176.35.145" val port = "9000" val table = "table1" val user = "defalut" val password = "default" I don't know how to write df directly into clickhouse, and I am not finding any similar answers.
sparkFish
  • 83
  • 1
  • 5
4
votes
3 answers

Creating index on existing table in Clickhouse

I am trying to add index on an existing table , with the below syntax. create table contact_in..... ( ....... domain string, topic string, category string ...... ...... ..... ..... ) ENGINE = MergeTree PARTITION BY category ORDER BY (topic, domain)…
Divyarao
  • 113
  • 2
  • 2
  • 5
4
votes
1 answer

Table TTL on SummingMergeTree

I have a table: CREATE TABLE metric ( cid UInt32, sid UInt32, sub String, cc UInt32, ic UInt32, cmc UInt32, acc UInt32, …
oddi
  • 91
  • 7
4
votes
2 answers

How to extract json from json in clickhouse?

I have got a json in my base: {"a":1,"b":2,"c":[{"d":3,"e":"str_1"}, {"d":4,"e":"str_2"}]} I need to get all unique values for every key, but I have some problems with extracting values for key 'd' and key 'e'. Using: SELECT DISTINCT…
Jens
  • 261
  • 1
  • 3
  • 16
4
votes
2 answers

Clickhouse select query without cache

Is there any "without cache" option in clickhouse select query? I want to check run-time performance of clickhouse without cache. I expect options like SQL_NO_CACHE in mysql. SELECT SQL_NO_CACHE * FROM table WHERE search= 'keyword';
hyeon
  • 373
  • 2
  • 4
  • 16
4
votes
0 answers

how to set column default value like current_timestamp in clickhouse?

does anyone know how to use a default value like current_timestamp in mysql when creating a clickhouse table? The now() udf is dynamic, instead of the time the row inserted, it is always the current time, it changes when select. Here is my…
kaijian.ding
  • 41
  • 1
  • 4
4
votes
4 answers

Pandas: How to insert dataframe into Clickhouse

I am trying to insert a Pandas dataframe into Clickhouse. This is my code import pandas import sqlalchemy as sa uri = 'clickhouse://default:@localhost/default' ch_db = sa.create_engine(uri) pdf = pandas.DataFrame.from_records([ {'year': 1994,…
Jabb
  • 3,414
  • 8
  • 35
  • 58
4
votes
1 answer

Testing-containers and clickhouse-driver error:Unexpected EOF while reading bytes

I have these libraries installed: testcontainers==2.5 clickhouse-driver==0.1.0 This code: from testcontainers.core.generic import GenericContainer from clickhouse_driver import Client def test_docker_run_clickhouse(): ch_container =…
techkuz
  • 3,608
  • 5
  • 34
  • 62
4
votes
2 answers

clickhouse downsample into OHLC time bar intervals

For a table e.g. containing a date, price timeseries with prices every e.g. millisecond, how can this be downsampled into groups of open high low close (ohlc) rows with time interval e.g. minute?
toby185
  • 83
  • 1
  • 6