# 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](https://docs.uibakery.io/concepts/data-sources#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.

![](https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FJ7a3MCsM28UMKlmOXax7%2FCleanShot%202025-04-23%20at%2013.44.00%402x-min.png?alt=media\&token=6eb40063-6049-4270-99cf-2b5c12f0ca77)
{% 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="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FZGd3ER0ZXiJfQj1nWR2Z%2FCleanShot%202025-04-23%20at%2013.23.12%402x-min.png?alt=media&#x26;token=ed582738-5e5e-4fdc-a1ed-b7c1795fbc03" 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](https://docs.uibakery.io/concepts/components/work-with-components/field-types-and-types-recognition).

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="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FxdMcnO7SP4kx7ddViTum%2FCleanShot%202025-04-23%20at%2013.33.20%402x-min.png?alt=media&#x26;token=fb41f37f-6391-4767-8151-3a9e5e07fd48" 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="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FEX7pj164RSVKDl1Xqz9f%2FCleanShot%202025-04-23%20at%2013.36.13%402x-min.png?alt=media&#x26;token=3fa1f61c-a740-473e-a4f6-816f4ebf1b44" 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](https://docs.uibakery.io/reference/working-with-actions/load-table-action)
* [Load Row](https://docs.uibakery.io/reference/working-with-actions/load-row-action)
* [Create Row](https://docs.uibakery.io/reference/working-with-actions/create-row-action)
* [Bulk Create Rows](https://docs.uibakery.io/reference/working-with-actions/bulk-create-rows-action)
* [Update Row](https://docs.uibakery.io/reference/working-with-actions/update-row-action)
* [Delete Row](https://docs.uibakery.io/reference/working-with-actions/delete-row-action)
* [Bulk Delete Rows](https://docs.uibakery.io/reference/working-with-actions/bulk-delete-rows-action)
* [SQL Query](https://docs.uibakery.io/reference/working-with-actions/sql-query)
