Change the prompt in clickhouse-client
Want to change your ClickHouse Client prompt? Read on.
Background
If you don't like how clickhouse client
displays the prompt in your terminal window, it's possible to change it by creating a single XML file. This article explains how to change the prompt to whatever you want.
The default prompt is your local computer name followed by :)
:
However, you can edit the prompt to be whatever you want:
Steps
To edit the prompt, follow these steps:
-
Find where you
clickhouse
executable is stored, and create a file callcustom-config.xml
in the same directory:./
├── clickhouse
├── custom-config.xml
...
├── user_scripts
└── uuid -
Inside
custom-config.xml
paste the following code:<?xml version="1.0" ?>
<clickhouse>
<prompt_by_server_display_name>
<default>CUSTOM_PROMPT_HERE</default>
</prompt_by_server_display_name>
</clickhouse> -
Replace
CUSTOM_PROMPT_HERE
with whatever you want your prompt to say. You must keep the prompt to a single line between the opening and closing<default>
tags:<?xml version="1.0" ?>
<clickhouse>
<prompt_by_server_display_name>
<default>local_clickhouse_client $> </default>
</prompt_by_server_display_name>
</clickhouse> -
Save the
custom-config.xml
file. -
Start the Clickhouse server if it isn't already running:
./clickhouse server
-
In a new terminal window, start the Clickhouse client with the
--config-file=custom-config.xml
argument:./clickhouse client --config-file="custom-config.xml"
-
The Clickhouse client should open and display your custom prompt: