---
title: PostgreSQL Integration
description: Automating content discovery and Privacy Request fulfillment by integrating MineOS with PostgreSQL
---

[Skip to content](https://docs.mineos.ai/knowledge/postgres-integration#main-content)

[![Mine](https://docs.mineos.ai/hs-fs/hubfs/Frame%201948756858.png?width=62&height=40&name=Frame%201948756858.png)](https://docs.mineos.ai/knowledge)

Open main navigation

Close main navigation

 Hello! How can we help you?

- There are no suggestions because the search field is empty.

1. [Help center](https://docs.mineos.ai/knowledge)
2. [Integrations](https://docs.mineos.ai/knowledge/integrations)

# PostgreSQL Integration

## Automating content discovery and Privacy Request fulfillment by integrating MineOS with PostgreSQL

This integration allows you to:

- Automate content classification to detect data types stored in your Postgres tables.
- Automate Copy and/or Delete requests for your Postgres tables.

### Before you start

- Make sure your MineOS plan supports integrations.
- Make sure you have the required information to your Postgres database (e.g. hostname, credentials, query etc).
- \[Optional\] **Enable Preview mode** to view sample PII values alongside classification results. The sample values are stored encrypted and automatically deleted after 7 days. You must enable Preview mode before running the scan to see sample values. For more information about how to set up Preview mode go [here](https://docs.mineos.ai/knowledge/data-classification-preview-mode).

Make sure to whitelist MineOS IPs in your database: [IP Whitelist](https://docs.mineos.ai/knowledge/ip-whitelisting)

### Setting up

To connect the Postgres integration, follow these steps:

1. On the left sidebar, click **Data Inventory** and then **Data Sources**
2. Click on **Add data source![](https://docs.mineos.ai/hubfs/undefined-Oct-18-2022-08-42-51-95-AM.png)**
3. Select **Postgres** from the catalog, then enter the **Postgres** page from your data sources list
4. In the **RequestHandling** tab, check the **Handle this data source in privacy requests**checkbox and choose the **Integration** handling style.
5. Enter your Postgres Database Connection String which can include: 
     1. **User ID**
     2. **User Password**
     3. **Server's IP / Hostname**
     4. **Database Name**
    For example, In the following format:
   
   **"Host=33.111.123.222;Database=dbName;Username=userName;Password=myPassword;"**
6. Note: If using MineOS VPN to connect with an internal database, [be sure to add the database's IP as a route in the VPN settings page.](https://docs.mineos.ai/knowledge/vpn-tunneling)

#### Setting up Content Discovery

Before using **Content Discovery** for your database, make sure to grant the Postgres user the required permissions (you can read about granting privileges **[here):](https://www.postgresql.org/docs/current/ddl-priv.html)**

- SELECT

Postgres integration will scan any databases and tables it has access to, so you can grant permissions to all tables or some. 

When running the scan, MineOS will scan all your databases and tables it has access to, and analyze rows and columns with our PII Processing Engine. Scan results will appear under "Data Classifier" in the side menu, and any detected data types will be associated with the Postgres system.

#### Setting up Privacy Requests

To handle privacy requests, you need to define the way in which different actions will be handled by the database. The available actions are:

- Delete - Deleting/anonymizing user data.
- Copy - Extracting user data.
- Preview - optional action used for previewing data when using an interactive flow

At least one of Delete or Copy is mandatory, while Preview is optional and can be left empty.

#### **Implementing Actions**

There are generally 2 ways to implement actions:

1. SQL Queries - directly inputting queries inside MineOS while making use of available variables, such asendUserEmail. You can also make use of transactions and multi-statement queries. This will require you to grant enough permissions to MineOS to execute the query you typed.
2. Executing Stored Procedures - Executing a stored procedure which is defined inside your Postgres database. This is the preferred method as it allows you to restrict MineOS permissions only to executing a specific stored procedure, as well as keeping your business logic inside your database.

**Note:** The queries you use won't be validated! You should run them in your **Postgres** account to make sure they are running as expected

#### **Example - Preview Query**

The query will be used for showing how many records were found as well as showing a sample (preview) of the data. Also, it will be used as a validation for the delete action.

Example Query:

```
SELECT name,phone,address FROM table1 WHERE email = {% raw %} '{{endUserEmail}}';
```

\* Preview will return the count of the number of records returned in the query response

\* Preview will show the first 3 values from the query response, it supports strings and long types

\* The '**endUserEmail**' variable is mandatory

#### **Example - Copy Query**

The Copy query will be used for the **Copy** action. Copy action is running on the ticket processing page in ticket of type **Copy** when clicking on **Generate Copy**

Example Query:

```
SELECT * FROM table1 WHERE email = {% raw %} '{{endUserEmail}}';
```

\* Copy will show all records returned in the query response

\* The '**endUserEmail**' variable is mandatory

#### **Example - Delete Query**

The Delete query will be used for the **Delete** action. Delete action is running on the ticket processing page in ticket of type **Deletion** when clicking on **Delete from X sources**

Example Query:

```
DELETE FROM table1 WHERE email = '{{endUserEmail}}';
```

\* The '**endUserEmail**' variable is mandatory.

Paste the details and queries in the **Request handling** tab in the correct inputs and click **Save.**

### **What's next?**

Read more about the deletion process using integrations [here](https://help.portal.saymine.com/knowledge/managing-deletion-requests-using-integrations).

Read more about the get a copy process using integrations [here](https://help.portal.saymine.com/knowledge/managing-copy-requests-using-integrations).

Talk to us if you need any help with Integrations via our chat or at [portal@saymine.com](mailto:portal@saymine.com), and we'll be happy to assist!🙂

- [Data Inventory](https://docs.mineos.ai/knowledge/data-inventory#main-content)

    - [Systems](https://docs.mineos.ai/knowledge/data-inventory#systems)
    - [Data types](https://docs.mineos.ai/knowledge/data-inventory#data-types)
    - [Activities](https://docs.mineos.ai/knowledge/data-inventory#activities)
- [Compliance Operations](https://docs.mineos.ai/knowledge/compliance-operations#main-content)

    - [Compliance reports](https://docs.mineos.ai/knowledge/compliance-operations#compliance-reports)
    - [Policies & alerts](https://docs.mineos.ai/knowledge/compliance-operations#policies-alerts)
    - [Risk assessments](https://docs.mineos.ai/knowledge/compliance-operations#risk-assessments)
- [DSR Handling](https://docs.mineos.ai/knowledge/dsr-handling#main-content)

    - [Setting Up Channels](https://docs.mineos.ai/knowledge/dsr-handling#setting-up-channels)
    - [Configuring Responses](https://docs.mineos.ai/knowledge/dsr-handling#configuring-responses)
    - [Processing Requests](https://docs.mineos.ai/knowledge/dsr-handling#processing-requests)
    - [Audit & Reporting](https://docs.mineos.ai/knowledge/dsr-handling#audit-reporting)
    - [Setting Up Rights & Workflows](https://docs.mineos.ai/knowledge/dsr-handling#setting-up-rights-workflows)
- [Integrations](https://docs.mineos.ai/knowledge/integrations#main-content)

    - [General information](https://docs.mineos.ai/knowledge/integrations#general-information)
- [Settings & Security](https://docs.mineos.ai/knowledge/settings-security#main-content)

    - [Security](https://docs.mineos.ai/knowledge/settings-security#security)
    - [Your Account](https://docs.mineos.ai/knowledge/settings-security#your-account)
- [Developers Documentation](https://docs.mineos.ai/knowledge/developers-documentation#main-content)

    - [Portal for developers](https://docs.mineos.ai/knowledge/developers-documentation#portal-for-developers)
    - [Webhook](https://docs.mineos.ai/knowledge/developers-documentation#webhook)
    - [Other](https://docs.mineos.ai/knowledge/developers-documentation#other)
- [Release Notes](https://docs.mineos.ai/knowledge/release-notes)
- [Consent Management](https://docs.mineos.ai/knowledge/consent-management)

[![Frame 1948756858](https://docs.mineos.ai/hs-fs/hubfs/Frame%201948756858.png?width=62&height=40&name=Frame%201948756858.png "Frame 1948756858")](https://mineos.ai/)

Copyright © 2026, "MineOS" (Saymine Technologies Inc)