You can integrate with Postgres in a few steps.
Follow these steps:

  • Create a read-only user
  • Grant it the permissions required for Sifflet to operate
  • Connect to Sifflet

1- Create a read-only user

To create the read-only user, you will need to run the following SQL queries.
Please choose a "username" (for instance, "sifflet_user") and a secure password. Store them carefully as you will need them to connect to Sifflet later.

CREATE ROLE sifflet_user LOGIN PASSWORD '<PASSWORD>';

2- Grant the permissions

You can now assign the permissions to the newly created user ("sifflet_user" for instance).
<schema_name> corresponds to the schema you will want Sifflet to monitor.

-- run the below queries for each "<schema_name>" you want to add to Sifflet
GRANT USAGE ON SCHEMA "<schema_name>" TO sifflet_user;
GRANT SELECT ON ALL TABLES IN SCHEMA "<schema_name>" TO sifflet_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA "<schema_name>" GRANT SELECT ON TABLES TO sifflet_user;

3- Connect to Sifflet

To connect to Postgres on Sifflet, you will need two items:

  • the connection details: your Host, Port, Database, and Schema
  • the secret which corresponds to the username and password you previously chose.
32163216

To create the Postgres secret, follow the below steps:

  • In "Integration" --> submenu "Secrets", create a new secret
  • In the "Secret" area, copy-paste the below text and replace it with the correct username and password previously created in part 1:
{
  "user": "<username>",
  "password": "<password>"
}

You can also refer to this page on adding a data source in Sifflet.