Skip to content

Commit 5152979

Browse files
committed
Update RMT table definitions to drop ZK path
1 parent 05c2703 commit 5152979

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

using-s3-and-clickhouse/sql-11-create-s3-replicated.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS test_local ON CLUSTER `{cluster}`
1616
`S` String,
1717
`D` Date
1818
)
19-
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/test_local', '{replica}')
19+
ENGINE = ReplicatedMergeTree
2020
PARTITION BY D ORDER BY A;
2121

2222
CREATE TABLE IF NOT EXISTS test ON CLUSTER `{cluster}`
@@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS test_s3_disk_local ON CLUSTER `{cluster}`
2929
`S` String,
3030
`D` Date
3131
)
32-
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/test_s3_disk_local', '{replica}')
32+
ENGINE = ReplicatedMergeTree
3333
PARTITION BY D
3434
ORDER BY A
3535
SETTINGS storage_policy = 's3_disk_policy';
@@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS test_s3_disk_with_replica_local ON CLUSTER `{cluster}
4444
`S` String,
4545
`D` Date
4646
)
47-
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/test_s3_disk_with_replica_local', '{replica}')
47+
ENGINE = ReplicatedMergeTree
4848
PARTITION BY D
4949
ORDER BY A
5050
SETTINGS storage_policy = 's3_disk_with_replica_policy';
@@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS test_s3_zero_copy_local ON CLUSTER `{cluster}`
5959
`S` String,
6060
`D` Date
6161
)
62-
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/test_s3_zero_copy_local', '{replica}')
62+
ENGINE = ReplicatedMergeTree
6363
PARTITION BY D
6464
ORDER BY A
6565
SETTINGS storage_policy = 's3_zero_copy_policy', allow_remote_fs_zero_copy_replication=1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Script to demonstrate replicated table creation with and without ZK path.
2+
DROP TABLE IF EXISTS demo ON CLUSTER `{cluster}` SYNC;
3+
4+
DROP TABLE IF EXISTS old_demo ON CLUSTER `{cluster}` SYNC;
5+
6+
-- Use an explicate path in ReplicatedMergeTree.
7+
CREATE TABLE IF NOT EXISTS old_demo ON CLUSTER `{cluster}`
8+
(
9+
`A` Int64,
10+
`S` String,
11+
`D` Date
12+
)
13+
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/old_demo', '{replica}')
14+
PARTITION BY D ORDER BY A;
15+
16+
-- Let the path argument in ReplicatedMergeTree default to path chosen by ClickHouse.
17+
CREATE TABLE IF NOT EXISTS demo ON CLUSTER `{cluster}`
18+
(
19+
`A` Int64,
20+
`S` String,
21+
`D` Date
22+
)
23+
ENGINE = ReplicatedMergeTree
24+
PARTITION BY D ORDER BY A;
25+
26+
INSERT INTO demo VALUES(1, 'one', now());
27+
28+
INSERT INTO demo VALUES(2, 'two', now());
29+
30+
SET show_table_uuid_in_table_create_query_if_not_nil=1;
31+
32+
SHOW CREATE TABLE demo FORMAT Vertical;
33+
34+
SELECT database, name, uuid from system.tables where database=currentDatabase();

0 commit comments

Comments
 (0)