2020-11-29 13:42:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-11-29 13:42:42 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -n --query "
|
|
|
|
DROP TABLE IF EXISTS test;
|
|
|
|
|
|
|
|
CREATE TABLE test
|
|
|
|
(
|
|
|
|
id UUID,
|
|
|
|
date_time DateTime,
|
|
|
|
x UInt32,
|
|
|
|
y UInt32
|
|
|
|
) ENGINE = MergeTree()
|
|
|
|
PARTITION BY toYYYYMMDD(date_time)
|
|
|
|
ORDER BY (date_time);
|
|
|
|
|
|
|
|
INSERT INTO test (x, y) VALUES (2, 1);
|
|
|
|
"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "SELECT x, y FROM test"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --mutations_sync 1 --param_x 1 --param_y 1 --query "
|
|
|
|
ALTER TABLE test
|
|
|
|
UPDATE x = {x:UInt32}
|
|
|
|
WHERE y = {y:UInt32};
|
|
|
|
"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "SELECT x, y FROM test"
|
2020-11-29 13:45:08 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE test"
|