Skip to main content
In this guide, you’ll learn how to connect your Postgres database to Omni.

Requirements

To follow the steps in this guide, you’ll need:
  • Organization Admin permissions in Omni
  • Permissions in Postgres that allow you to create database users

Setup

1

Create an Omni database user

  1. In your Postgres database, run the following command to create a database user for Omni:
    Create Omni user
    CREATE USER omni WITH ENCRYPTED PASSWORD '<password>';
    GRANT CONNECT ON DATABASE database_name to omni;
    \c database_name
    GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO omni;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO omni;
    
  2. Grant permissions to the Omni user. If you’re using a schema other than public, run the following to grant usage to Omni:
    Grant usage to the Omni user
    GRANT USAGE ON SCHEMA schema_name TO omni
    
  3. Lastly, ensure any tables created in the future will be accessible:
    Grant permissions to future tables to the Omni user
    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON tables TO omni;
    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON sequences TO omni;
    
2

Set up a table upload schema

import UploadSchemaCallout from “/snippets/connect-data/upload-schema-callout.mdx”;In this step, you’ll create a dedicated schema to use for table uploads. This schema can’t be used for other modeled tables.
  1. Create the schema in Postgres.
  2. Run the following commands to grant the Omni user the required privileges:
    Grant Omni user permissions to upload schema
    GRANT USAGE, CREATE ON SCHEMA upload_schema_name TO omni;
    
3

Allowlist Omni's IP addresses

If access to the Postgres database is limited by IP address, you’ll need to add Omni’s IPs to the allowlist before you create the database connection.Omni’s IP addresses can be found on an individual connection’s page, accessed by navigating to Settings > Connections and clicking a connection.
4

Create the connection in Omni

  1. In Omni, click Settings > Connections.
  2. Click the Postgres option.
  3. On the connection setup page, fill in the connection details:
    NameRequired?Description
    Display Name YesA user-friendly name for the connection, which will be used throughout Omni
    Host YesThe hostname or IP address of the database server
    Port YesThe port number for the database connection. Defaults to 5432.
    Database YesThe database to connect to
    Include Schemas NoA Comma-separated list of schemas to include in the connection
    Offloaded Schemas NoA comma-separated list of schemas to include in the connection, which will only load on demand. This setting is good for very large schemas or dbt dev schemas.
    Schema for Table Uploads NoThe name of the schema to use for table (CSV) uploads. If left blank, you can upload tables but they won’t be pushed to the database or be available for use in joins.
    Username YesThe username for database authentication
    Password YesThe password for database authentication
    Database Timezone YesThe timezone used by the database
    Query Timezone YesThe timezone to use for Omni queries. If a timezone is specified, data will be converted from the Database timezone to the selected timezone.
    Allow User-Specific Timezones NoWhen enabled, users can override the connection timezone with their own when querying
    Query Timeout NoMaximum time in seconds before a query times out
    Infer Relationships from Foreign Keys NoWhen enabled, Omni will automatically infer relationships between tables based on foreign key constraints in the database
  4. When finished, click Create connection.

What’s next?

Now that your Postgress is set up, you can: