# PostgreSQL

UI Bakery allows you to easily connect to a PostgreSQL database with no need for additional layers like APIs or third-party services.

## Configuration

### Prerequisites

If your database is hosted behind a Firewall, you need to add our [IP addresses](/concepts/data-sources.md#whitelisting-ip-addresses) to the Firewall whitelist.

### Connecting the data source

1. On the **Data sources** page, click **Connect**, and select *PostgreSQL* in the Data sources list.
2. Specify all the required credentials.

{% hint style="warning" %}
If you're connecting via **bit.io**, make sure to specify your **repository name** in the *Schemas name* field. Click *Add* to save it, otherwise you'll get an error.

![](/files/b9tGebhewIHfGLoEUmW2)
{% endhint %}

3. Click **Test connection** to check whether the data source can be connected, and then click **Connect Datasource** to complete the setup.

<figure><img src="/files/7mWDcpqzJO7QXzllGs5a" alt=""><figcaption></figcaption></figure>

UI Bakery will extract the database structure and store column types. This data will be used to suggest proper [table columns and form field types](/concepts/components/work-with-components/field-types-and-types-recognition.md).

If you need to be able to override the default data source database with a custom value in an action, you can enable the **Allow override database name in action** setting.

<figure><img src="/files/hLxQFIYSoDtBT097vj11" alt=""><figcaption></figcaption></figure>

Once enabled, when configuring the action, you will be able to specify a custom database. In case a database is not specified, the default data source database will be used.

<figure><img src="/files/1q1ss5s4g1IWClxGfLMs" alt=""><figcaption></figcaption></figure>

## Usage

Once you have established the connection between UI Bakery and PostgreSQL, you can access its data - load it and send it back.

The following *Action steps* are supported with PostgreSQL:

* [Load Table](/reference/working-with-actions/load-table-action.md)
* [Load Row](/reference/working-with-actions/load-row-action.md)
* [Create Row](/reference/working-with-actions/create-row-action.md)
* [Bulk Create Rows](/reference/working-with-actions/bulk-create-rows-action.md)
* [Update Row](/reference/working-with-actions/update-row-action.md)
* [Delete Row](/reference/working-with-actions/delete-row-action.md)
* [Bulk Delete Rows](/reference/working-with-actions/bulk-delete-rows-action.md)
* [SQL Query](/reference/working-with-actions/sql-query.md)


---

# 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.uibakery.io/reference/data-sources/postgresql.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.
