Skip to main content

Change the prompt in clickhouse-client

This article explains how to change the prompt in your Clickhouse client and clickhouse-local terminal window from :) to a prefix followed by :)

If you don't like how clickhouse client and clickhouse-local display the prompt in your terminal window, it is possible to change it to add a prefix. This article explains how to change the prompt to whatever you want.

The default prompt is your local computer name followed by :) :

The following are variables that you can use in a prompt: {user}, {host}

There are several ways to update the prompt and we'll go through them each.

--prompt flag

The first way to change the flag is using the --prompt:

This will add the finger emoji before the smiley face:

Config file - top level

Alternatively, you can provide a prompt prefix in a config.xml file:

We can use a config file with any name we like and pass it in using the -C flag:

Prefer your config files to be in YAML? That works too:

Config file - connections_credentials

Alternatively, you can specify a prompt per connection credentials. This only makes sense when using clickhouse-client.

We can then try to connect with the dev connection:

Or the prod one:

And here's a YAML version:

With the dev connnection:

And now prod:

· 2 min read