From 5a052263687954c99d5c854ba8e866f3b7b0f476 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 24 Jul 2024 12:02:09 +0900 Subject: [PATCH 1/2] Add ClickHouse sample --- Makefile | 2 + docker-compose.yml => compose.yml | 4 +- ...id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md | 27 +++ ...d.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg | 29 ++++ sample/clickhouse/README.md | 28 ++++ sample/clickhouse/id_value_dictionary.md | 27 +++ sample/clickhouse/id_value_dictionary.svg | 29 ++++ sample/clickhouse/materialized_view.md | 33 ++++ sample/clickhouse/materialized_view.svg | 29 ++++ sample/clickhouse/numbers_table.md | 26 +++ sample/clickhouse/numbers_table.svg | 26 +++ sample/clickhouse/schema.json | 1 + sample/clickhouse/schema.svg | 154 ++++++++++++++++++ sample/clickhouse/source_table.md | 34 ++++ sample/clickhouse/source_table.svg | 29 ++++ sample/clickhouse/t1.md | 26 +++ sample/clickhouse/t1.svg | 26 +++ sample/clickhouse/table_name.md | 52 ++++++ sample/clickhouse/table_name.svg | 47 ++++++ sample/clickhouse/view.md | 30 ++++ sample/clickhouse/view.svg | 38 +++++ 21 files changed, 695 insertions(+), 2 deletions(-) rename docker-compose.yml => compose.yml (97%) create mode 100644 sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md create mode 100644 sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg create mode 100644 sample/clickhouse/README.md create mode 100644 sample/clickhouse/id_value_dictionary.md create mode 100644 sample/clickhouse/id_value_dictionary.svg create mode 100644 sample/clickhouse/materialized_view.md create mode 100644 sample/clickhouse/materialized_view.svg create mode 100644 sample/clickhouse/numbers_table.md create mode 100644 sample/clickhouse/numbers_table.svg create mode 100644 sample/clickhouse/schema.json create mode 100644 sample/clickhouse/schema.svg create mode 100644 sample/clickhouse/source_table.md create mode 100644 sample/clickhouse/source_table.svg create mode 100644 sample/clickhouse/t1.md create mode 100644 sample/clickhouse/t1.svg create mode 100644 sample/clickhouse/table_name.md create mode 100644 sample/clickhouse/table_name.svg create mode 100644 sample/clickhouse/view.md create mode 100644 sample/clickhouse/view.svg diff --git a/Makefile b/Makefile index 827c7f0b..d7290539 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ doc: build doc_sqlite $(TBLS) doc ms://SA:MSSQLServer-Passw0rd@localhost:11433/testdb -c testdata/test_tbls_mssql.yml -f sample/mssql $(TBLS) doc mongodb://mongoadmin:secret@localhost:27017/test?authSource=admin -f sample/mongo env AWS_ENDPOINT_URL=http://localhost:18000 $(TBLS) doc dynamodb://ap-northeast-1 -c testdata/test_tbls_dynamodb.yml -f sample/dynamodb + $(TBLS) doc clickhouse://default@localhost:9000/testdb -f sample/clickhouse $(TBLS) doc pg://postgres:pgpass@localhost:55413/testdb?sslmode=disable -c testdata/test_tbls_postgres.yml -j -f sample/adjust $(TBLS) doc my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t png -f sample/png $(TBLS) doc my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t mermaid -f sample/mermaid @@ -84,6 +85,7 @@ testdoc: build testdoc_sqlite $(TBLS) diff ms://SA:MSSQLServer-Passw0rd@localhost:11433/testdb -c testdata/test_tbls_mssql.yml sample/mssql $(TBLS) diff mongodb://mongoadmin:secret@localhost:27017/test?authSource=admin sample/mongo env AWS_ENDPOINT_URL=http://localhost:18000 $(TBLS) diff dynamodb://ap-northeast-1 -c testdata/test_tbls_dynamodb.yml sample/dynamodb + $(TBLS) diff clickhouse://default@localhost:9000/testdb sample/clickhouse $(TBLS) diff pg://postgres:pgpass@localhost:55413/testdb?sslmode=disable -c testdata/test_tbls_postgres.yml -j sample/adjust $(TBLS) diff my://root:mypass@localhost:33308/testdb -c testdata/test_tbls.yml -t png sample/png $(TBLS) diff my://root:mypass@localhost:33308/testdb -c testdata/exclude_test_tbls.yml sample/exclude diff --git a/docker-compose.yml b/compose.yml similarity index 97% rename from docker-compose.yml rename to compose.yml index 6bf04873..26de5a98 100644 --- a/docker-compose.yml +++ b/compose.yml @@ -1,8 +1,7 @@ -version: '3.4' - services: postgres95: image: postgres:9.5 + platform: linux/amd64 restart: always ports: - "55432:5432" @@ -21,6 +20,7 @@ services: - POSTGRES_DB=testdb mysql56: image: mysql:5.6 + platform: linux/amd64 restart: always ports: - "33306:3306" diff --git a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md new file mode 100644 index 00000000..4072e379 --- /dev/null +++ b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md @@ -0,0 +1,27 @@ +# .inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 + +## Description + +
+Table Definition + +```sql +CREATE TABLE testdb.`.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67` (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| name1 | UInt64 | | false | | | | +| name2 | Nullable(String) | | false | | | | + +## Relations + +![er](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg new file mode 100644 index 00000000..4305d67a --- /dev/null +++ b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg @@ -0,0 +1,29 @@ + + + + + + +.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 + + + +.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 + + +.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 +     +[Memory] + +name1 +[UInt64] + +name2 +[Nullable(String)] + + + + diff --git a/sample/clickhouse/README.md b/sample/clickhouse/README.md new file mode 100644 index 00000000..d27c63c5 --- /dev/null +++ b/sample/clickhouse/README.md @@ -0,0 +1,28 @@ +# testdb + +## Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md) | 2 | | Memory | +| [id_value_dictionary](id_value_dictionary.md) | 2 | | Dictionary | +| [materialized_view](materialized_view.md) | 2 | | MaterializedView | +| [numbers_table](numbers_table.md) | 1 | | SystemNumbers | +| [source_table](source_table.md) | 2 | | MergeTree | +| [t1](t1.md) | 1 | | Memory | +| [table_name](table_name.md) | 8 | comment for table | MergeTree | +| [view](view.md) | 5 | | View | + +## Stored procedures and functions + +| Name | ReturnType | Arguments | Type | +| ---- | ------- | ------- | ---- | +| linear_equation | | | | + +## Relations + +![er](schema.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/id_value_dictionary.md b/sample/clickhouse/id_value_dictionary.md new file mode 100644 index 00000000..0ceaad3d --- /dev/null +++ b/sample/clickhouse/id_value_dictionary.md @@ -0,0 +1,27 @@ +# id_value_dictionary + +## Description + +
+Table Definition + +```sql +CREATE DICTIONARY testdb.id_value_dictionary (`id` UInt64, `value` String) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'source_table')) LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT()) +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | UInt64 | | false | | | | +| value | String | | false | | | | + +## Relations + +![er](id_value_dictionary.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/id_value_dictionary.svg b/sample/clickhouse/id_value_dictionary.svg new file mode 100644 index 00000000..a1596bbc --- /dev/null +++ b/sample/clickhouse/id_value_dictionary.svg @@ -0,0 +1,29 @@ + + + + + + +id_value_dictionary + + + +id_value_dictionary + + +id_value_dictionary +     +[Dictionary] + +id +[UInt64] + +value +[String] + + + + diff --git a/sample/clickhouse/materialized_view.md b/sample/clickhouse/materialized_view.md new file mode 100644 index 00000000..e40a56a3 --- /dev/null +++ b/sample/clickhouse/materialized_view.md @@ -0,0 +1,33 @@ +# materialized_view + +## Description + +
+Table Definition + +```sql +CREATE MATERIALIZED VIEW testdb.materialized_view (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory AS SELECT name1, name2 FROM testdb.table_name ORDER BY name1 DESC +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| name1 | UInt64 | | false | | | | +| name2 | Nullable(String) | | false | | | | + +## Referenced Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [table_name](table_name.md) | 8 | comment for table | MergeTree | + +## Relations + +![er](materialized_view.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/materialized_view.svg b/sample/clickhouse/materialized_view.svg new file mode 100644 index 00000000..d3d89c44 --- /dev/null +++ b/sample/clickhouse/materialized_view.svg @@ -0,0 +1,29 @@ + + + + + + +materialized_view + + + +materialized_view + + +materialized_view +     +[MaterializedView] + +name1 +[UInt64] + +name2 +[Nullable(String)] + + + + diff --git a/sample/clickhouse/numbers_table.md b/sample/clickhouse/numbers_table.md new file mode 100644 index 00000000..115c7c5b --- /dev/null +++ b/sample/clickhouse/numbers_table.md @@ -0,0 +1,26 @@ +# numbers_table + +## Description + +
+Table Definition + +```sql +CREATE TABLE testdb.numbers_table (`number` UInt64) AS numbers(100) +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| number | UInt64 | | false | | | | + +## Relations + +![er](numbers_table.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/numbers_table.svg b/sample/clickhouse/numbers_table.svg new file mode 100644 index 00000000..ad72a87b --- /dev/null +++ b/sample/clickhouse/numbers_table.svg @@ -0,0 +1,26 @@ + + + + + + +numbers_table + + + +numbers_table + + +numbers_table +     +[SystemNumbers] + +number +[UInt64] + + + + diff --git a/sample/clickhouse/schema.json b/sample/clickhouse/schema.json new file mode 100644 index 00000000..4b8a0da4 --- /dev/null +++ b/sample/clickhouse/schema.json @@ -0,0 +1 @@ +{"name":"testdb","desc":"","tables":[{"name":".inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67","type":"Memory","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.`.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67` (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory"},{"name":"id_value_dictionary","type":"Dictionary","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE DICTIONARY testdb.id_value_dictionary (`id` UInt64, `value` String) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'source_table')) LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT())"},{"name":"materialized_view","type":"MaterializedView","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE MATERIALIZED VIEW testdb.materialized_view (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory AS SELECT name1, name2 FROM testdb.table_name ORDER BY name1 DESC","referenced_tables":["table_name"]},{"name":"numbers_table","type":"SystemNumbers","comment":"","columns":[{"name":"number","type":"UInt64","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.numbers_table (`number` UInt64) AS numbers(100)"},{"name":"source_table","type":"MergeTree","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.source_table (`id` UInt64, `value` String) ENGINE = MergeTree PRIMARY KEY id ORDER BY id SETTINGS index_granularity = 8192"},{"name":"t1","type":"Memory","comment":"","columns":[{"name":"x","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.t1 (`x` String) ENGINE = Memory"},{"name":"table_name","type":"MergeTree","comment":"comment for table","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":"comment for column 1"},{"name":"name2","type":"Nullable(String)","nullable":false,"default":"DEFAULT 'column 2'","comment":"comment for column 2"},{"name":"name3","type":"LowCardinality(String)","nullable":false,"default":"MATERIALIZED upper(name2)","comment":"comment for column 3"},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":"DEFAULT now()","comment":""},{"name":"name6","type":"String","nullable":false,"default":"ALIAS formatReadableSize(name1)","comment":""},{"name":"name7","type":"String","nullable":false,"default":"MATERIALIZED hex(name1)","comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":"DEFAULT unhex(name7)","comment":""}],"indexes":[{"name":"idx1","def":"bloom_filter(0.01)","table":"table_name","columns":["name1"],"comment":""},{"name":"idx2","def":"minmax","table":"table_name","columns":["name1 * 2"],"comment":""},{"name":"idx3","def":"set(1000)","table":"table_name","columns":["name1 * length(name2)"],"comment":""}],"constraints":[{"name":"partition key","type":"PARTITION KEY","def":"PARTITION BY ((name1, name3, name5))","table":"table_name","referenced_table":null,"columns":["name1","name3","name5"],"referenced_columns":null,"comment":""},{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"sampling key","type":"SAMPLING KEY","def":"SAMPLE BY (name1)","table":"table_name","referenced_table":null,"columns":["name1"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.table_name (`name1` UInt64 COMMENT 'comment for column 1', `name2` Nullable(String) DEFAULT 'column 2' COMMENT 'comment for column 2' CODEC(ZSTD(1)), `name3` LowCardinality(String) MATERIALIZED upper(name2) COMMENT 'comment for column 3', `name4` SimpleAggregateFunction(sum, Float64) TTL name5 + toIntervalDay(1), `name5` DateTime DEFAULT now(), `name6` String ALIAS formatReadableSize(name1), `name7` String MATERIALIZED hex(name1), `name8` FixedString(4) DEFAULT unhex(name7), INDEX idx1 name1 TYPE bloom_filter(0.01) GRANULARITY 1, INDEX idx2 name1 * 2 TYPE minmax GRANULARITY 3, INDEX idx3 name1 * length(name2) TYPE set(1000) GRANULARITY 4, PROJECTION projection_name_1 (SELECT name1, name2, name3 ORDER BY name1)) ENGINE = MergeTree PARTITION BY (name1, name3, name5) PRIMARY KEY (name1, name5) ORDER BY (name1, name5) SAMPLE BY name1 SETTINGS index_granularity = 8192 COMMENT 'comment for table'"},{"name":"view","type":"View","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":null,"comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE VIEW testdb.view (`name1` UInt64, `name2` Nullable(String), `name4` SimpleAggregateFunction(sum, Float64), `name5` DateTime, `name8` FixedString(4)) AS SELECT * FROM testdb.table_name"}],"relations":[],"functions":[{"name":"linear_equation","return_type":"","arguments":"","type":""}],"driver":{"name":"clickhouse","database_version":"24.4.4.85","meta":{"dict":{"Functions":"Stored procedures and functions"}}}} diff --git a/sample/clickhouse/schema.svg b/sample/clickhouse/schema.svg new file mode 100644 index 00000000..8eacfab2 --- /dev/null +++ b/sample/clickhouse/schema.svg @@ -0,0 +1,154 @@ + + + + + + +testdb + + + +.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 + + +.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 +     +[Memory] + +name1     +[UInt64] + +name2     +[Nullable(String)] + + + +id_value_dictionary + + +id_value_dictionary +     +[Dictionary] + +id     +[UInt64] + +value     +[String] + + + +materialized_view + + +materialized_view +     +[MaterializedView] + +name1     +[UInt64] + +name2     +[Nullable(String)] + + + +numbers_table + + +numbers_table +     +[SystemNumbers] + +number     +[UInt64] + + + +source_table + + +source_table +     +[MergeTree] + +id     +[UInt64] + +value     +[String] + + + +t1 + + +t1 +     +[Memory] + +x     +[String] + + + +table_name + + +table_name +     +[MergeTree] + +name1     +[UInt64] + +name2     +[Nullable(String)] + +name3     +[LowCardinality(String)] + +name4     +[SimpleAggregateFunction(sum, Float64)] + +name5     +[DateTime] + +name6     +[String] + +name7     +[String] + +name8     +[FixedString(4)] + + + +view + + +view +     +[View] + +name1     +[UInt64] + +name2     +[Nullable(String)] + +name4     +[SimpleAggregateFunction(sum, Float64)] + +name5     +[DateTime] + +name8     +[FixedString(4)] + + + diff --git a/sample/clickhouse/source_table.md b/sample/clickhouse/source_table.md new file mode 100644 index 00000000..0763c4f2 --- /dev/null +++ b/sample/clickhouse/source_table.md @@ -0,0 +1,34 @@ +# source_table + +## Description + +
+Table Definition + +```sql +CREATE TABLE testdb.source_table (`id` UInt64, `value` String) ENGINE = MergeTree PRIMARY KEY id ORDER BY id SETTINGS index_granularity = 8192 +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | UInt64 | | false | | | | +| value | String | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| sorting key | SORTING KEY | ORDER BY (id) | +| primary key | PRIMARY KEY | PRIMARY KEY (id) | + +## Relations + +![er](source_table.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/source_table.svg b/sample/clickhouse/source_table.svg new file mode 100644 index 00000000..b788f0c8 --- /dev/null +++ b/sample/clickhouse/source_table.svg @@ -0,0 +1,29 @@ + + + + + + +source_table + + + +source_table + + +source_table +     +[MergeTree] + +id +[UInt64] + +value +[String] + + + + diff --git a/sample/clickhouse/t1.md b/sample/clickhouse/t1.md new file mode 100644 index 00000000..210ea6f7 --- /dev/null +++ b/sample/clickhouse/t1.md @@ -0,0 +1,26 @@ +# t1 + +## Description + +
+Table Definition + +```sql +CREATE TABLE testdb.t1 (`x` String) ENGINE = Memory +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| x | String | | false | | | | + +## Relations + +![er](t1.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/t1.svg b/sample/clickhouse/t1.svg new file mode 100644 index 00000000..30fe4d23 --- /dev/null +++ b/sample/clickhouse/t1.svg @@ -0,0 +1,26 @@ + + + + + + +t1 + + + +t1 + + +t1 +     +[Memory] + +x +[String] + + + + diff --git a/sample/clickhouse/table_name.md b/sample/clickhouse/table_name.md new file mode 100644 index 00000000..fb25255e --- /dev/null +++ b/sample/clickhouse/table_name.md @@ -0,0 +1,52 @@ +# table_name + +## Description + +comment for table + +
+Table Definition + +```sql +CREATE TABLE testdb.table_name (`name1` UInt64 COMMENT 'comment for column 1', `name2` Nullable(String) DEFAULT 'column 2' COMMENT 'comment for column 2' CODEC(ZSTD(1)), `name3` LowCardinality(String) MATERIALIZED upper(name2) COMMENT 'comment for column 3', `name4` SimpleAggregateFunction(sum, Float64) TTL name5 + toIntervalDay(1), `name5` DateTime DEFAULT now(), `name6` String ALIAS formatReadableSize(name1), `name7` String MATERIALIZED hex(name1), `name8` FixedString(4) DEFAULT unhex(name7), INDEX idx1 name1 TYPE bloom_filter(0.01) GRANULARITY 1, INDEX idx2 name1 * 2 TYPE minmax GRANULARITY 3, INDEX idx3 name1 * length(name2) TYPE set(1000) GRANULARITY 4, PROJECTION projection_name_1 (SELECT name1, name2, name3 ORDER BY name1)) ENGINE = MergeTree PARTITION BY (name1, name3, name5) PRIMARY KEY (name1, name5) ORDER BY (name1, name5) SAMPLE BY name1 SETTINGS index_granularity = 8192 COMMENT 'comment for table' +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| name1 | UInt64 | | false | | | comment for column 1 | +| name2 | Nullable(String) | DEFAULT 'column 2' | false | | | comment for column 2 | +| name3 | LowCardinality(String) | MATERIALIZED upper(name2) | false | | | comment for column 3 | +| name4 | SimpleAggregateFunction(sum, Float64) | | false | | | | +| name5 | DateTime | DEFAULT now() | false | | | | +| name6 | String | ALIAS formatReadableSize(name1) | false | | | | +| name7 | String | MATERIALIZED hex(name1) | false | | | | +| name8 | FixedString(4) | DEFAULT unhex(name7) | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| partition key | PARTITION KEY | PARTITION BY ((name1, name3, name5)) | +| sorting key | SORTING KEY | ORDER BY (name1, name5) | +| primary key | PRIMARY KEY | PRIMARY KEY (name1, name5) | +| sampling key | SAMPLING KEY | SAMPLE BY (name1) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| idx1 | bloom_filter(0.01) | +| idx2 | minmax | +| idx3 | set(1000) | + +## Relations + +![er](table_name.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/table_name.svg b/sample/clickhouse/table_name.svg new file mode 100644 index 00000000..f8df9bdf --- /dev/null +++ b/sample/clickhouse/table_name.svg @@ -0,0 +1,47 @@ + + + + + + +table_name + + + +table_name + + +table_name +     +[MergeTree] + +name1 +[UInt64] + +name2 +[Nullable(String)] + +name3 +[LowCardinality(String)] + +name4 +[SimpleAggregateFunction(sum, Float64)] + +name5 +[DateTime] + +name6 +[String] + +name7 +[String] + +name8 +[FixedString(4)] + + + + diff --git a/sample/clickhouse/view.md b/sample/clickhouse/view.md new file mode 100644 index 00000000..65b406b4 --- /dev/null +++ b/sample/clickhouse/view.md @@ -0,0 +1,30 @@ +# view + +## Description + +
+Table Definition + +```sql +CREATE VIEW testdb.view (`name1` UInt64, `name2` Nullable(String), `name4` SimpleAggregateFunction(sum, Float64), `name5` DateTime, `name8` FixedString(4)) AS SELECT * FROM testdb.table_name +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| name1 | UInt64 | | false | | | | +| name2 | Nullable(String) | | false | | | | +| name4 | SimpleAggregateFunction(sum, Float64) | | false | | | | +| name5 | DateTime | | false | | | | +| name8 | FixedString(4) | | false | | | | + +## Relations + +![er](view.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/view.svg b/sample/clickhouse/view.svg new file mode 100644 index 00000000..8739b719 --- /dev/null +++ b/sample/clickhouse/view.svg @@ -0,0 +1,38 @@ + + + + + + +view + + + +view + + +view +     +[View] + +name1 +[UInt64] + +name2 +[Nullable(String)] + +name4 +[SimpleAggregateFunction(sum, Float64)] + +name5 +[DateTime] + +name8 +[FixedString(4)] + + + + From fed85ef5ef1f3e9ec9bac26d29f228d6c05fb996 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 24 Jul 2024 12:22:41 +0900 Subject: [PATCH 2/2] Hide `.inner_id.*` tables --- drivers/clickhouse/clickhouse.go | 19 ++ ...id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md | 27 -- ...d.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg | 29 --- sample/clickhouse/README.md | 1 - sample/clickhouse/schema.json | 2 +- sample/clickhouse/schema.svg | 231 ++++++++---------- 6 files changed, 128 insertions(+), 181 deletions(-) delete mode 100644 sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md delete mode 100644 sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg diff --git a/drivers/clickhouse/clickhouse.go b/drivers/clickhouse/clickhouse.go index 9cfc444f..64325d47 100644 --- a/drivers/clickhouse/clickhouse.go +++ b/drivers/clickhouse/clickhouse.go @@ -3,12 +3,17 @@ package clickhouse import ( "database/sql" "fmt" + "regexp" + _ "github.com/ClickHouse/clickhouse-go/v2" "github.com/k1LoW/tbls/dict" "github.com/k1LoW/tbls/schema" "github.com/pkg/errors" + "github.com/samber/lo" ) +var shadowTableRe = regexp.MustCompile(`^\.inner_id\.`) + // ClickHouse struct type ClickHouse struct { db *sql.DB @@ -35,6 +40,7 @@ func (ch *ClickHouse) Analyze(s *schema.Schema) error { tableSortingKeys := make(map[string]*schema.Constraint) tablePrimaryKeys := make(map[string]*schema.Constraint) tableSamplingKeys := make(map[string]*schema.Constraint) + var filtered []string tableRows, err := ch.db.Query(` SELECT @@ -83,6 +89,11 @@ WHERE database = ? Comment: tableComment, } + if shadowTableRe.MatchString(tableName) { + filtered = append(filtered, tableName) + continue + } + s.Tables = append(s.Tables, table) if tablePartitionKey != "" { @@ -191,6 +202,10 @@ ORDER BY table Nullable: false, } + if lo.Contains(filtered, colTable) { + continue + } + table, err := s.FindTableByName(colTable) if err != nil { return errors.WithStack(err) @@ -276,6 +291,10 @@ ORDER BY table return errors.WithStack(err) } + if lo.Contains(filtered, idxTable) { + continue + } + table, err := s.FindTableByName(idxTable) if err != nil { return errors.WithStack(err) diff --git a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md deleted file mode 100644 index 4072e379..00000000 --- a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md +++ /dev/null @@ -1,27 +0,0 @@ -# .inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 - -## Description - -
-Table Definition - -```sql -CREATE TABLE testdb.`.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67` (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory -``` - -
- -## Columns - -| Name | Type | Default | Nullable | Children | Parents | Comment | -| ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| name1 | UInt64 | | false | | | | -| name2 | Nullable(String) | | false | | | | - -## Relations - -![er](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg) - ---- - -> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg b/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg deleted file mode 100644 index 4305d67a..00000000 --- a/sample/clickhouse/.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 - - - -.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 - - -.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 -     -[Memory] - -name1 -[UInt64] - -name2 -[Nullable(String)] - - - - diff --git a/sample/clickhouse/README.md b/sample/clickhouse/README.md index d27c63c5..980bf52c 100644 --- a/sample/clickhouse/README.md +++ b/sample/clickhouse/README.md @@ -4,7 +4,6 @@ | Name | Columns | Comment | Type | | ---- | ------- | ------- | ---- | -| [.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67](.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67.md) | 2 | | Memory | | [id_value_dictionary](id_value_dictionary.md) | 2 | | Dictionary | | [materialized_view](materialized_view.md) | 2 | | MaterializedView | | [numbers_table](numbers_table.md) | 1 | | SystemNumbers | diff --git a/sample/clickhouse/schema.json b/sample/clickhouse/schema.json index 4b8a0da4..3f9307a2 100644 --- a/sample/clickhouse/schema.json +++ b/sample/clickhouse/schema.json @@ -1 +1 @@ -{"name":"testdb","desc":"","tables":[{"name":".inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67","type":"Memory","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.`.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67` (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory"},{"name":"id_value_dictionary","type":"Dictionary","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE DICTIONARY testdb.id_value_dictionary (`id` UInt64, `value` String) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'source_table')) LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT())"},{"name":"materialized_view","type":"MaterializedView","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE MATERIALIZED VIEW testdb.materialized_view (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory AS SELECT name1, name2 FROM testdb.table_name ORDER BY name1 DESC","referenced_tables":["table_name"]},{"name":"numbers_table","type":"SystemNumbers","comment":"","columns":[{"name":"number","type":"UInt64","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.numbers_table (`number` UInt64) AS numbers(100)"},{"name":"source_table","type":"MergeTree","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.source_table (`id` UInt64, `value` String) ENGINE = MergeTree PRIMARY KEY id ORDER BY id SETTINGS index_granularity = 8192"},{"name":"t1","type":"Memory","comment":"","columns":[{"name":"x","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.t1 (`x` String) ENGINE = Memory"},{"name":"table_name","type":"MergeTree","comment":"comment for table","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":"comment for column 1"},{"name":"name2","type":"Nullable(String)","nullable":false,"default":"DEFAULT 'column 2'","comment":"comment for column 2"},{"name":"name3","type":"LowCardinality(String)","nullable":false,"default":"MATERIALIZED upper(name2)","comment":"comment for column 3"},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":"DEFAULT now()","comment":""},{"name":"name6","type":"String","nullable":false,"default":"ALIAS formatReadableSize(name1)","comment":""},{"name":"name7","type":"String","nullable":false,"default":"MATERIALIZED hex(name1)","comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":"DEFAULT unhex(name7)","comment":""}],"indexes":[{"name":"idx1","def":"bloom_filter(0.01)","table":"table_name","columns":["name1"],"comment":""},{"name":"idx2","def":"minmax","table":"table_name","columns":["name1 * 2"],"comment":""},{"name":"idx3","def":"set(1000)","table":"table_name","columns":["name1 * length(name2)"],"comment":""}],"constraints":[{"name":"partition key","type":"PARTITION KEY","def":"PARTITION BY ((name1, name3, name5))","table":"table_name","referenced_table":null,"columns":["name1","name3","name5"],"referenced_columns":null,"comment":""},{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"sampling key","type":"SAMPLING KEY","def":"SAMPLE BY (name1)","table":"table_name","referenced_table":null,"columns":["name1"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.table_name (`name1` UInt64 COMMENT 'comment for column 1', `name2` Nullable(String) DEFAULT 'column 2' COMMENT 'comment for column 2' CODEC(ZSTD(1)), `name3` LowCardinality(String) MATERIALIZED upper(name2) COMMENT 'comment for column 3', `name4` SimpleAggregateFunction(sum, Float64) TTL name5 + toIntervalDay(1), `name5` DateTime DEFAULT now(), `name6` String ALIAS formatReadableSize(name1), `name7` String MATERIALIZED hex(name1), `name8` FixedString(4) DEFAULT unhex(name7), INDEX idx1 name1 TYPE bloom_filter(0.01) GRANULARITY 1, INDEX idx2 name1 * 2 TYPE minmax GRANULARITY 3, INDEX idx3 name1 * length(name2) TYPE set(1000) GRANULARITY 4, PROJECTION projection_name_1 (SELECT name1, name2, name3 ORDER BY name1)) ENGINE = MergeTree PARTITION BY (name1, name3, name5) PRIMARY KEY (name1, name5) ORDER BY (name1, name5) SAMPLE BY name1 SETTINGS index_granularity = 8192 COMMENT 'comment for table'"},{"name":"view","type":"View","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":null,"comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE VIEW testdb.view (`name1` UInt64, `name2` Nullable(String), `name4` SimpleAggregateFunction(sum, Float64), `name5` DateTime, `name8` FixedString(4)) AS SELECT * FROM testdb.table_name"}],"relations":[],"functions":[{"name":"linear_equation","return_type":"","arguments":"","type":""}],"driver":{"name":"clickhouse","database_version":"24.4.4.85","meta":{"dict":{"Functions":"Stored procedures and functions"}}}} +{"name":"testdb","desc":"","tables":[{"name":"id_value_dictionary","type":"Dictionary","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE DICTIONARY testdb.id_value_dictionary (`id` UInt64, `value` String) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'source_table')) LIFETIME(MIN 0 MAX 1000) LAYOUT(FLAT())"},{"name":"materialized_view","type":"MaterializedView","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE MATERIALIZED VIEW testdb.materialized_view (`name1` UInt64, `name2` Nullable(String)) ENGINE = Memory AS SELECT name1, name2 FROM testdb.table_name ORDER BY name1 DESC","referenced_tables":["table_name"]},{"name":"numbers_table","type":"SystemNumbers","comment":"","columns":[{"name":"number","type":"UInt64","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.numbers_table (`number` UInt64) AS numbers(100)"},{"name":"source_table","type":"MergeTree","comment":"","columns":[{"name":"id","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"value","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"source_table","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.source_table (`id` UInt64, `value` String) ENGINE = MergeTree PRIMARY KEY id ORDER BY id SETTINGS index_granularity = 8192"},{"name":"t1","type":"Memory","comment":"","columns":[{"name":"x","type":"String","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE TABLE testdb.t1 (`x` String) ENGINE = Memory"},{"name":"table_name","type":"MergeTree","comment":"comment for table","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":"comment for column 1"},{"name":"name2","type":"Nullable(String)","nullable":false,"default":"DEFAULT 'column 2'","comment":"comment for column 2"},{"name":"name3","type":"LowCardinality(String)","nullable":false,"default":"MATERIALIZED upper(name2)","comment":"comment for column 3"},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":"DEFAULT now()","comment":""},{"name":"name6","type":"String","nullable":false,"default":"ALIAS formatReadableSize(name1)","comment":""},{"name":"name7","type":"String","nullable":false,"default":"MATERIALIZED hex(name1)","comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":"DEFAULT unhex(name7)","comment":""}],"indexes":[{"name":"idx1","def":"bloom_filter(0.01)","table":"table_name","columns":["name1"],"comment":""},{"name":"idx2","def":"minmax","table":"table_name","columns":["name1 * 2"],"comment":""},{"name":"idx3","def":"set(1000)","table":"table_name","columns":["name1 * length(name2)"],"comment":""}],"constraints":[{"name":"partition key","type":"PARTITION KEY","def":"PARTITION BY ((name1, name3, name5))","table":"table_name","referenced_table":null,"columns":["name1","name3","name5"],"referenced_columns":null,"comment":""},{"name":"sorting key","type":"SORTING KEY","def":"ORDER BY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"primary key","type":"PRIMARY KEY","def":"PRIMARY KEY (name1, name5)","table":"table_name","referenced_table":null,"columns":["name1","name5"],"referenced_columns":null,"comment":""},{"name":"sampling key","type":"SAMPLING KEY","def":"SAMPLE BY (name1)","table":"table_name","referenced_table":null,"columns":["name1"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE testdb.table_name (`name1` UInt64 COMMENT 'comment for column 1', `name2` Nullable(String) DEFAULT 'column 2' COMMENT 'comment for column 2' CODEC(ZSTD(1)), `name3` LowCardinality(String) MATERIALIZED upper(name2) COMMENT 'comment for column 3', `name4` SimpleAggregateFunction(sum, Float64) TTL name5 + toIntervalDay(1), `name5` DateTime DEFAULT now(), `name6` String ALIAS formatReadableSize(name1), `name7` String MATERIALIZED hex(name1), `name8` FixedString(4) DEFAULT unhex(name7), INDEX idx1 name1 TYPE bloom_filter(0.01) GRANULARITY 1, INDEX idx2 name1 * 2 TYPE minmax GRANULARITY 3, INDEX idx3 name1 * length(name2) TYPE set(1000) GRANULARITY 4, PROJECTION projection_name_1 (SELECT name1, name2, name3 ORDER BY name1)) ENGINE = MergeTree PARTITION BY (name1, name3, name5) PRIMARY KEY (name1, name5) ORDER BY (name1, name5) SAMPLE BY name1 SETTINGS index_granularity = 8192 COMMENT 'comment for table'"},{"name":"view","type":"View","comment":"","columns":[{"name":"name1","type":"UInt64","nullable":false,"default":null,"comment":""},{"name":"name2","type":"Nullable(String)","nullable":false,"default":null,"comment":""},{"name":"name4","type":"SimpleAggregateFunction(sum, Float64)","nullable":false,"default":null,"comment":""},{"name":"name5","type":"DateTime","nullable":false,"default":null,"comment":""},{"name":"name8","type":"FixedString(4)","nullable":false,"default":null,"comment":""}],"indexes":[],"constraints":[],"triggers":[],"def":"CREATE VIEW testdb.view (`name1` UInt64, `name2` Nullable(String), `name4` SimpleAggregateFunction(sum, Float64), `name5` DateTime, `name8` FixedString(4)) AS SELECT * FROM testdb.table_name"}],"relations":[],"functions":[{"name":"linear_equation","return_type":"","arguments":"","type":""}],"driver":{"name":"clickhouse","database_version":"24.4.4.85","meta":{"dict":{"Functions":"Stored procedures and functions"}}}} diff --git a/sample/clickhouse/schema.svg b/sample/clickhouse/schema.svg index 8eacfab2..0d3d6a7e 100644 --- a/sample/clickhouse/schema.svg +++ b/sample/clickhouse/schema.svg @@ -4,151 +4,136 @@ - + testdb - - - -.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 - - -.inner_id.b9cd26f9-5548-4c71-b1f8-b62716652d67 -     -[Memory] - -name1     -[UInt64] - -name2     -[Nullable(String)] - + - + id_value_dictionary - - -id_value_dictionary -     -[Dictionary] - -id     -[UInt64] - -value     -[String] + + +id_value_dictionary +     +[Dictionary] + +id     +[UInt64] + +value     +[String] - + materialized_view - - -materialized_view -     -[MaterializedView] - -name1     -[UInt64] - -name2     -[Nullable(String)] + + +materialized_view +     +[MaterializedView] + +name1     +[UInt64] + +name2     +[Nullable(String)] - + numbers_table - - -numbers_table -     -[SystemNumbers] - -number     -[UInt64] + + +numbers_table +     +[SystemNumbers] + +number     +[UInt64] - + source_table - - -source_table -     -[MergeTree] - -id     -[UInt64] - -value     -[String] + + +source_table +     +[MergeTree] + +id     +[UInt64] + +value     +[String] - + t1 - - -t1 -     -[Memory] - -x     -[String] + + +t1 +     +[Memory] + +x     +[String] - + table_name - - -table_name -     -[MergeTree] - -name1     -[UInt64] - -name2     -[Nullable(String)] - -name3     -[LowCardinality(String)] - -name4     -[SimpleAggregateFunction(sum, Float64)] - -name5     -[DateTime] - -name6     -[String] - -name7     -[String] - -name8     -[FixedString(4)] + + +table_name +     +[MergeTree] + +name1     +[UInt64] + +name2     +[Nullable(String)] + +name3     +[LowCardinality(String)] + +name4     +[SimpleAggregateFunction(sum, Float64)] + +name5     +[DateTime] + +name6     +[String] + +name7     +[String] + +name8     +[FixedString(4)] - + view - - -view -     -[View] - -name1     -[UInt64] - -name2     -[Nullable(String)] - -name4     -[SimpleAggregateFunction(sum, Float64)] - -name5     -[DateTime] - -name8     -[FixedString(4)] + + +view +     +[View] + +name1     +[UInt64] + +name2     +[Nullable(String)] + +name4     +[SimpleAggregateFunction(sum, Float64)] + +name5     +[DateTime] + +name8     +[FixedString(4)]