Documentation ¶
Overview ¶
Package main provides the main entry point for the CLI application.
The main function parses the command line arguments, creates a graph of tables, and saves it to the specified output file or outputs it to the console depending on the specified options:
- --clickhouse-host string - Clickhouse host to get tables from. Optional. Default value is "localhost"
- --clickhouse-port string - Clickhouse port. Optional. Default value 9000
- --clickhouse-table string - Clickhouse full table name in format <database>.<table> to get dependencies for. Required.
- --clickhouse-user string - Clickhouse username. Optional. Default value is "" (empty string)
- --out-file string - Output file name. Optional. If not specified, the output will be printed to the console.
- --out-format string - Output format. Default value "mermaid-html". Possible values: "mermaid-html", "mermaid-md".
- --mermaid-theme - Mermaid theme. Optional. Default value is 'default'. See https://mermaid-js.github.io/mermaid/#/theming
- --table-highlight-color - Highlight color for the selected clickhouse table. E.g. '#ff5757' or 'red' Optional. If not specified, the table will not be highlighted. See https://mermaid.js.org/syntax/flowchart.html?id=flowcharts-basic-syntax#styling-a-node
Note: The command will ask for the ClickHouse password for the specified user.
For example command:
go run . --clickhouse-host=localhost --clickhouse-port=9000 --clickhouse-user=test_user --clickhouse-table=test_db.test_table --out-format=mermaid-html --out-file=output.html
will do the following:
- ask for ClickHouse password for the clickhouse server on localhost:9000;
- connect to the ClickHouse server on localhost:9000 with the test_user and the provided password;
- fetch the list of all tables (which can be accessed by the user) from the system.tables;
- create a graph of tables connected to the specified table test_db.test_table;
- export graph to the mermaid html format;
- save the exported mermaid html to output.html file;
Click to show internal directories.
Click to hide internal directories.