# PostgreSQL

You can connect Tability to PostgreSQL to automatically pull query results into your check-ins.

Once you add PostgreSQL as a data source for an outcome/Key Result, Tability can:

* Run your saved query and preview the current numeric value in the check-in flow.
* Automatically sync your metric while the plan is active on Premium subscriptions.

{% hint style="info" %}
Available on Plus and Premium subscriptions
{% endhint %}

## How to enable the integration

### Step 1. Open the integrations page

Go to **Workspace Settings > Integrations**.

### Step 2. Connect PostgreSQL

1. Find **PostgreSQL** in the **Data connectors** section
2. Click **Connect to PostgreSQL**
3. Enter the database name
4. Enter the server host
5. Enter the server port
6. Enter the username and password
7. Click **Save**

This creates a workspace-level PostgreSQL connection.

## How to add a data source to an outcome/key result

### Step 1. Open the outcome or KPI editor

Open your outcome or KPI, then go to the **Data Source** tab.

### Step 2. Select PostgreSQL

Choose **PostgreSQL** from the list of available data sources.

### Step 3. Write your SQL query

Add the SQL query Tability should run to fetch the metric.

The current UI only accepts:

* `SELECT` queries
* Queries without semicolons

### Step 4. Save and preview

Click **Save & preview** to validate the query and load the current value.

## How the data source is used in check-ins

Once the connector is saved, Tability runs the saved query and displays the current numeric result in the check-in form.

If auto-sync is enabled on a Premium subscription, Tability will also create synced check-ins automatically while the plan is active.


---

# 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://guides.tability.io/docs/become-a-tability-power-user/integrations/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.
