> 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/de/kontext/knowledge-bases/add-data/import-from-sql-database/data-sources/postgres.md).

# Postgres

Eine Postgres-Datenbank in AirOps verbinden

{% hint style="info" %}
**Denken Sie daran, unsere IP-Adresse auf die Zulassungsliste zu setzen. `52.71.87.39`**

Wenn Ihre Datenbank durch eine Firewall geschützt ist, denken Sie daran, eingehenden Zugriff auf die IP-Adresse von AirOps über den Datenbankport zuzulassen.
{% endhint %}

## Postgres als Datenbank in AirOps hinzufügen

Um eine neue Datenbankverbindung einzurichten, gehe zu **⚙️ Einstellungen > Warehouse-Einrichtung > Quelle hinzufügen**

Gib anschließend Folgendes ein:

1. **Host** – Der Hostname oder die IP-Adresse deines PostgreSQL-Servers.

   Beispiel: `example-postgres-instance.abcdefghijkl.us-west-2.rds.amazonaws.com`
2. **Port** – Der Port, auf dem dein PostgreSQL-Server Verbindungen entgegennimmt. Standardmäßig ist dies `5432`.
3. **Benutzer** – Der PostgreSQL-Benutzer, mit dem AirOps eine Verbindung zur Datenbank herstellt. Es empfiehlt sich, einen neuen Benutzer für AirOps anzulegen (Anleitung unten). Es kann jedoch jeder Benutzer mit SELECT-Berechtigungen verwendet werden.
4. **Passwort** – Das Passwort des oben genannten Benutzers.
5. **Datenbank** – Die PostgreSQL-Datenbank, mit der AirOps eine Verbindung herstellt.

<figure><img src="https://1960680173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FX2n5yPRPynbnWuO4SH0M%2Fuploads%2Fgit-blob-ecd4ddd3fb641cf40dfdc4e9a2def26342c02531%2Fpostgres-01-form.png?alt=media" alt="Postgres connection form with host, port, user, password, and database fields and a Connect button"><figcaption><p>Gib die Verbindungsdetails für Postgres ein.</p></figcaption></figure>

## Benutzer einrichten und Zugriff gewähren

Um eine PostgreSQL-Datenbank als Datenquelle in AirOps hinzuzufügen, verwende einen bestehenden Benutzer oder erstelle einen Benutzer mit **Lesezugriff** auf die Tabellen und Schemas, auf die du über AirOps zugreifen möchtest:

### 1. AirOps-Benutzer erstellen

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

### 2. USAGE- und SELECT-Berechtigungen gewähren

Ersetze die Platzhalter durch die passenden Schema- und Tabellennamen, auf die AirOps zugreifen soll.

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

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

Wenn du Zugriff auf mehrere Tabellen gewähren möchtest, kannst du die Anweisung `GRANT SELECT` für jede Tabelle ausführen oder `GRANT SELECT ON ALL TABLES`.

### 3. (Optional) Zugriff auf zukünftige Tabellen im Schema gewähren

Wenn du Zugriff auf alle zukünftigen Tabellen in einem Schema gewähren möchtest, kannst du den folgenden Befehl verwenden. Ersetze dabei den Platzhalter durch den passenden Schemanamen:

```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/de/kontext/knowledge-bases/add-data/import-from-sql-database/data-sources/postgres.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.
