PostgreSQL

Connecting DinMo to PostgreSQL: Step-by-Step Guide

Go to the workspace settings, then to the Source tab, and click "Add New Source".

  • Step 1: Select PostgreSQL from the list of available sources

  • Step 2: Create a DinMo user on your DataWarehouse and the DinMo technical datasets. DinMo needs to read all the tables that you want to use to build models and segments. It also needs to write access to 3 schemas that will be used to store technical (segment queries, segment stats, activation snapshots).

    We recommend you to create a specific user for DinMo and grant it the needed permissions.

    You can do so by running the following SQL snippet.

-- Give the DinMo user the ability to sign in with a password
CREATE USER DINMO_USER WITH PASSWORD '<strong, unique password>';

-- Create the schemas that DinMo will use to store technical data that enables to run your activations

CREATE SCHEMA IF NOT EXISTS DINMO_DELTA_STORAGE;
CREATE SCHEMA IF NOT EXISTS DINMO_SEGMENTS;
CREATE SCHEMA IF NOT EXISTS DINMO_STATS;
CREATE SCHEMA IF NOT EXISTS DINMO_PREDICTIONS;

-- Grant the DinMo user full access to these schemas

GRANT CREATE, USAGE ON SCHEMA DINMO_DELTA_STORAGE TO DINMO_USER;
GRANT CREATE, USAGE ON SCHEMA DINMO_SEGMENTS TO DINMO_USER;
GRANT CREATE, USAGE ON SCHEMA DINMO_STATS TO DINMO_USER;
GRANT CREATE, USAGE ON SCHEMA DINMO_PREDICTIONS TO DINMO_USER;

-- Let the DinMo user read and query the schemas that contain the data that you want to use in the DinMo Platform
-- Replace <your schema> with the name of the schema where you store the tables and views that will be used in the DinMo Platform 
-- Repeat this operation for all the schemas that store relevant data that you want to connect to DinMo 

GRANT USAGE ON SCHEMA "<your schema>" TO DINMO_USER;
GRANT SELECT ON ALL TABLES IN SCHEMA "<your schema>" TO DINMO_USER;
ALTER DEFAULT PRIVILEGES IN SCHEMA "<your schema>" GRANT SELECT ON TABLES TO DINMO_USER;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA "<your schema>" TO DINMO_USER;
ALTER DEFAULT PRIVILEGES IN SCHEMA "<your schema>" GRANT EXECUTE ON FUNCTIONS TO DINMO_USER;

Please edit the <value> fields in the script to define your own credentials and parameters.

  • Step 3: Fill in the required information

    • Host: The hostname or IP address of your cluster.

    • Database: The name of the database in your cluster.

    • Port: The port number of your cluster. The default is 5439, but yours may be different.

    • User and password: The credentials you created in the script above.

  • Step 4: Hit "Save & Test". This will launch a test ensuring that the connection is working. If so, congratulations, your source setup is finished!

Last updated