> For the complete documentation index, see [llms.txt](https://integrations.drivetrain.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://integrations.drivetrain.ai/integration-guide/readme/databases-and-warehouses/integrating-with-postgres.md).

# Integrating with Postgres

Connect PostgreSQL to Drivetrain and automate data ingestion into planning models. Covers host, port, and user credentials.

## Postgres setup <a href="#postgres-setup" id="postgres-setup"></a>

Drivetrain connects to Postgres using a secure TCP/IP connection over the standard PostgreSQL port. To get started, share the following details with us.

## Required details <a href="#required-details" id="required-details"></a>

1. **Hostname & Port**: We need this detail to locate your Postgres server and port to use for the connection. For example: `your-db.company.com:5432`
2. **Username**: This is used to authenticate and identify the database user for the connection. Make sure the user has **read** access to the schema and tables you intend to share.
3. **Password:** Used along with the username to securely authenticate the connection to your database.
4. **Schema Name:** PostgreSQL organizes data into schemas. This tells us which specific part of your database to look into.
5. **Table Names:** This helps us identify the specific tables within the schema from which data should be extracted.

## Best practices

1. We recommend creating a **dedicated read-only user** for this integration to ensure access is limited and controlled.
2. If needed, we can provide our **static IP address** to allowlist in your firewall for secure connectivity.


---

# 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://integrations.drivetrain.ai/integration-guide/readme/databases-and-warehouses/integrating-with-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.
