# Postgres

The Postgres piece in ZBrain Flow provides seamless integration with PostgreSQL databases, allowing you to query and manipulate data directly from your workflows. This powerful connector enables you to run SQL queries, retrieve results, and incorporate database operations into your automation processes. With Postgres integration, you can build workflows that access relational data, perform complex data operations, update records, and extract information from your PostgreSQL databases—all without requiring manual intervention or additional coding. This piece is ideal for businesses that store critical information in PostgreSQL and want to incorporate that data into their automated processes.

### **How to Use Postgres in ZBrain Flow?** <a href="#how-to-use-postgres-in-zbrain-flow" id="how-to-use-postgres-in-zbrain-flow"></a>

**Step 1: Select Postgres as Your Connection**

* Click on the '+' button in the Flow and search for Postgres.
* Select Postgres.
* The primary action available is:
  * **Run Query** – Execute SQL statements against your PostgreSQL database.

**Step 2: Configure Your Postgres Connection**

* If this is your first time connecting to PostgreSQL, you'll need to set up a connection:
  * Click on 'Select a connection' and then 'Create connection'
  * Enter a descriptive 'Connection Name'
  * Provide your database 'Host' (server address)
  * Specify the 'Port' (an integer)
  * Enter your database 'User' credentials
  * Provide the 'Password' for authentication
  * Specify the 'Database' name to connect to
  * Configure SSL options if your database requires secure connections
  * Toggle 'Verify server certificate' on to validate the database server's SSL certificate
  * Optionally upload a 'Certificate' if you're using a custom CA for verification
  * Click 'Save' to create the connection

**Step 3: Configure Your SQL Query**

* In the 'Query' field, enter your SQL statement. For security, use parameterized queries with placeholders ($1, $2, etc.) instead of directly inserting dynamic values.
* Add query arguments by clicking 'Add Item' in the 'Arguments' section.

**Step 4: Configure Performance Settings**

* Set 'Query Timeout' to limit the maximum execution time (in milliseconds).
* Adjust 'Connection Timeout' to control how long to wait for a database connection.
* Optionally provide an 'Application Name' to identify your connection in database logs.

<br>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/postgres.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
