データベーススキーマを文書化する必要が生じた場合、異なるDBMSが同様のタスクのための独自のツールを提供します。そしてDESC table_name
、ClickHouseを含め、それらのほとんどがサポートしています。ただし、このコマンドの結果は、私たちが望むほど表現力がありません。
DESCRIBE TABLE data_lr name type default_type default_expression comment codec_expression ttl_expression Path String ZSTD(3) Value Float64 Gorilla, LZ4 Time UInt32 DoubleDelta, LZ4 Date Date DoubleDelta, LZ4 Timestamp UInt32 DoubleDelta, LZ4
同時に、システムテーブルtables
とcolumns
包括的な情報が含まれているため、ここで取得できることを組み合わせると、かなりの結果が得られます。

インスピレーション
致命的な欠陥のない自分自身の解決策を注意深く見始める前に、私は利用可能なオプションを探しました。そして、この仕事は私自身のプロジェクトを始めるように私を刺激しました。いくつかの空白は、そこから感謝の気持ちを込めて借りました。
PlantUMLとは
この製品が何であるかについて一言。理解を深めるために、公式ページにアクセスすることをお勧めします。一言で言えば、これは図のテキスト記述を変換するプログラムです。次に例を示します。
@startuml Bob -> Alice : hello @enduml
画像で

, , , , . Atlassian Confluence, wiki. pandoc ( ), LaTeX, .
: system.tables , , , , . , system.columns, . , , . .
, , . , . , ReplacingMergeTree Version. . Replicated*MergeTree. MaterializedView . , MV.
. , ± . -. .
. , Distributed , Buffer *MergeTree
, . . .
@startuml ' This diagram is generated with https://github.com/Felixoid/clickhouse-plantuml !define Table(x) class x << (T,mistyrose) >> !define View(x) class x << (V,lightblue) >> !define MaterializedView(x) class x << (m,orange) >> !define Distributed(x) class x << (D,violet) >> hide empty methods hide stereotypes skinparam classarrowcolor gray Distributed(graphite.data) { ENGINE=**Distributed** ..engine config.. cluster: graphite_data database: graphite table: data_lr sharding_key: cityHash64(Path) ==columns== Path: String Value: Float64 Time: UInt32 Date: Date Timestamp: UInt32 } Table(graphite.data_lr) { ENGINE=**ReplicatedGraphiteMergeTree** ..engine config.. rollup_config: graphite_rollup ..replication.. zoo_path: /clickhouse/tables/graphite.data_lr/{shard} replica: {replica} ==columns== Path: String <size:15><&signal></size> Value: Float64 Time: UInt32 <size:15><&signal></size> Date: Date <size:15><&list-rich></size> Timestamp: UInt32 ..<size:15><&list-rich></size>partition key.. toYYYYMMDD(toStartOfInterval(Date, toIntervalDay(3))) ..<size:15><&signal></size>sorting key.. Path, Time } Table(graphite.index) { ENGINE=**ReplicatedReplacingMergeTree** ..engine config.. version: Version ..replication.. zoo_path: /clickhouse/tables/graphite.index/1 replica: {replica} ==columns== Date: Date <size:15><&list-rich></size> <size:15><&signal></size> Level: UInt32 <size:15><&signal></size> Path: String <size:15><&signal></size> Version: UInt32 ..<size:15><&list-rich></size>partition key.. toYYYYMM(Date) ..<size:15><&signal></size>sorting key.. Level, Path, Date } Table(graphite.tagged) { ENGINE=**ReplicatedReplacingMergeTree** ..engine config.. version: Version ..replication.. zoo_path: /clickhouse/tables/graphite.tagged/1 replica: {replica} ==columns== Date: Date <size:15><&list-rich></size> <size:15><&signal></size> Tag1: String <size:15><&signal></size> Path: String <size:15><&signal></size> Tags: Array(String) Version: UInt32 ..<size:15><&list-rich></size>partition key.. toYYYYMM(Date) ..<size:15><&signal></size>sorting key.. Tag1, Path, Date } graphite.data_lr -|> graphite.data @enduml

, — ClickHouse. ClickHouse. , - issue. , .
, - .
, pypi:
pip install clickhouse-plantuml clickhouse-plantuml -h