> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.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 = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/0_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=795bd04f063883bd9d07e96f13333b62" 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.webp" />

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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/1_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=5dd87c77648a5180e7f5139b8196f531" 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.webp" />

<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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/2_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=3a22bd3631147f1b8992b1c52d0d8aba" 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.webp" />

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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/3_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=f9e3e4849a9cf2fd44769654142359bd" 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.webp" />

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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/4_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=3f6a29e782a4a328af422f9b36922ea7" 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.webp" />

<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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/5_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=f650a375acbd7fc9fb0f8d0eee647fc5" 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.webp" />

Ou a `prod`:

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

<Image img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/6_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=48809cc37214cd3165824e65124847ed" 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.webp" />

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-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/7_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=635f7ed0b8bb831f5698fef9288154cf" 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.webp" />

E agora `prod`:

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

<Image img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/khTo4jdOlx_yU9ob/images/knowledgebase/change-the-prompt-in-clickhouse-client/8_prompt.webp?fit=max&auto=format&n=khTo4jdOlx_yU9ob&q=85&s=32d8fe5aee7e62982707ef1152407f78" 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.webp" />
