> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-1d264819.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Altere o prompt no clickhouse-client

> Este artigo explica como alterar o prompt no ClickHouse client e na janela do terminal do clickhouse-local de :) para um prefixo seguido de :)

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

Se você não gosta de como o `clickhouse client` e o clickhouse-local exibem o prompt no terminal, é possível alterá-lo para incluir um prefixo.
Este artigo explica como mudar o prompt para o que você quiser.

O prompt padrão é o nome do seu computador local seguido de `:) `:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/0_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=c44d4f4e84d74874c118db43484c4dc1" size="md" alt="Prompt padrão do ClickHouse client" width="2289" height="411" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/0_prompt.png" />

Estas são as variáveis que você pode usar em um prompt: `{user}`, `{host}`

Há várias maneiras de alterar o prompt, e vamos passar por cada uma delas.

<div id="--prompt-flag">
  ## flag `--prompt`
</div>

A primeira forma de alterar a flag é com `--prompt`:

```bash theme={null}
clickhouse --prompt 👉
```

Isso adicionará o emoji de dedo antes da carinha sorridente:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/1_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=eff63be436ceab1c97081e1606b2467e" size="md" alt="Prompt do ClickHouse client com emoji de dedo" width="2298" height="386" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/1_prompt.png" />

<div id="config-file---top-level">
  ## Arquivo de configuração - nível superior
</div>

Como alternativa, você pode fornecer um prefixo de prompt em um arquivo `config.xml`:

```xml theme={null}
<config>
    <prompt>👉 </prompt>
</config>
```

```
clickhouse
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/2_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=697568843cf70f8f7809cec7adb85cae" size="md" alt="Prompt do ClickHouse client com arquivo de configuração" width="2307" height="769" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/2_prompt.png" />

Podemos usar um arquivo de configuração com o nome que quisermos e passá-lo com a flag `-C`:

```xml theme={null}
<config>
    <prompt>🎄 </prompt>
</config>
```

```
clickhouse -C christmas.xml
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/3_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=11bf7bb77aec3b4f9ac10a3c4c11727e" size="md" alt="prompt do ClickHouse client com emoji de árvore de Natal" width="2314" height="781" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/3_prompt.png" />

Prefere seus arquivos de config em YAML?
Isso também funciona:

```yaml theme={null}
prompt: 🟡
```

```bash theme={null}
clickhouse -C christmas.yaml
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/4_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=b5f28237096c350049e89d8e52bf1e86" size="md" alt="Prompt do ClickHouse client com emoji de círculo amarelo" width="2302" height="600" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/4_prompt.png" />

<div id="config-file---connections_credentials">
  ## Arquivo de configuração - connections\_credentials
</div>

Como alternativa, você pode especificar um prompt para cada credencial de conexão.
Isso só faz sentido ao usar o clickhouse-client.

```xml theme={null}
<config>
    <connections_credentials>
        <connection>
            <n>prod<n>
            <hostname>127.0.0.1</hostname>
            <port>9000</port>
            <secure>0</secure>
            <user>default</user>
            <prompt>\e[31m[PRODUCTION]\e[0m {user}@prod</prompt>
        </connection>
        <connection>
            <n>dev<n>
            <hostname>127.0.0.1</hostname>
            <port>9000</port>
            <secure>0</secure>
            <user>default</user>
            <prompt>\e[32m[DEVELOPMENT]\e[0m {user}@dev</prompt>
        </connection>
    </connections_credentials>
</config>
```

Podemos então tentar nos conectar usando a conexão `dev`:

```bash theme={null}
clickhouse client -C connections.xml --connection dev
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/5_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=4e6fa440808edb4f538aa7e432ef3e31" size="md" alt="Prompt do ClickHouse client com conexão de desenvolvimento" width="1310" height="203" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/5_prompt.png" />

Ou a `prod`:

```bash theme={null}
clickhouse client -C connections.xml --connection prod
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/6_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=0b2297d84b1323ff745af1438207e6cd" size="md" alt="prompt do ClickHouse client com conexão de produção" width="1297" height="189" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/6_prompt.png" />

E aqui está a versão em YAML:

```yaml theme={null}
connections_credentials:
  connection:
    - name: prod
      hostname: 127.0.0.1
      port: 9000
      secure: 0
      user: default
      prompt: "\e[35m[PRODUCTION]\e[0m {user}@{host}"
    - name: dev
      hostname: 127.0.0.1
      port: 9000
      secure: 0
      user: default
      prompt: "\e[34m[DEVELOPMENT]\e[0m {user}@{host}"
```

Com a conexão `dev`:

```bash theme={null}
clickhouse client -C connections.yaml --connection dev
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/7_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=887d3958c3487a347ef46b7b5584ff4d" size="md" alt="Prompt do ClickHouse client com conexão de desenvolvimento usando YAML" width="1581" height="169" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/7_prompt.png" />

E agora `prod`:

```bash theme={null}
clickhouse client -C connections.yaml --connection prod
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-1d264819/x-Hr7E6ACyUjaYG3/images/knowledgebase/change-the-prompt-in-clickhouse-client/8_prompt.png?fit=max&auto=format&n=x-Hr7E6ACyUjaYG3&q=85&s=e734c3212ea1616f9d42237f7b56d203" size="md" alt="prompt do ClickHouse client com conexão de produção usando YAML" width="1525" height="187" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/8_prompt.png" />
