> For the complete documentation index, see [llms.txt](https://docs.airops.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airops.com/docs/pt/contexto/knowledge-bases/add-data/import-from-sql-database/data-sources/redshift.md).

# Redshift

Conecte a uma base de dados Redshift no AirOps

{% hint style="info" %}
**Lembre-se de adicionar o nosso endereço IP à lista de permissões `52.71.87.39`**

Se a sua base de dados estiver protegida por uma firewall, lembre-se de permitir o acesso de entrada ao endereço IP da AirOps através da porta da sua base de dados.
{% endhint %}

1. **Anfitrião ou IP** - O endpoint do seu cluster AWS Redshift.\
   Exemplo: `examplecluster.abcdefghijkl.us-west-2.redshift.amazonaws.com`
2. **Porta** - A porta em que o seu cluster Redshift está a escutar. O valor predefinido é `5439`.
3. **Utilizador** - O utilizador do Redshift com o qual a AirOps se irá ligar à base de dados. É recomendável criar um novo utilizador para a AirOps (instruções abaixo), mas pode ser usado qualquer utilizador com privilégios SELECT.
4. **Palavra-passe** - Palavra-passe do utilizador acima.
5. **Base de dados** - A base de dados Redshift à qual a AirOps se irá ligar.

<figure><img src="https://31915162-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX2n5yPRPynbnWuO4SH0M%2Fuploads%2Fgit-blob-21ac5467827d81e59b237c2555bc0359fb913dc8%2Fredshift-01-form.png?alt=media" alt="Redshift connection form with host, port, user, password, and database fields and a Connect button"><figcaption><p>Introduza os dados de ligação do Redshift.</p></figcaption></figure>

## Configurar o utilizador e conceder acesso (para novos utilizadores)

Para adicionar uma base de dados AWS Redshift como fonte de dados na AirOps, use um utilizador existente ou crie um utilizador com acesso de **leitura** às tabelas e aos esquemas a que pretende aceder a partir da AirOps:

### 1. Criar o utilizador da AirOps

```sql
CREATE USER airops_user
PASSWORD '<secure-password>';
```

### 2. Conceder privilégios USAGE e SELECT ao utilizador da AirOps

Substitua `<schema>` e `<table>` pelos nomes de esquema e de tabela adequados com os quais pretende que a AirOps interaja.

```sql
GRANT USAGE ON SCHEMA "<schema>" TO airops_user;

GRANT SELECT ON TABLE "<schema>"."<table>" TO airops_user;
```

Se pretender conceder acesso a várias tabelas, pode executar a instrução `GRANT SELECT` para cada tabela.

### 3. (Opcional) Conceder acesso a futuras tabelas no esquema

Se pretender conceder acesso a todas as futuras tabelas de um esquema, pode usar o seguinte comando. Substitua pelo nome de esquema adequado.

```sql
ALTER DEFAULT PRIVILEGES IN SCHEMA "<schema>"
GRANT SELECT ON TABLES TO airops_user;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.airops.com/docs/pt/contexto/knowledge-bases/add-data/import-from-sql-database/data-sources/redshift.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
