Skip to main content

Intro

PostgreSQL is a widely used open-source relational database management system. You can use Domo’s PostgreSQL SSH Connector to pull data from your PostgreSQL database via an SSH tunnel and compile custom reports. You indicate the data you want by inputting an SQL query. For more information about the PostgreSQL API, visit their website. (https://www.postgresql.org/docs/ ) The PostgreSQL SSH connector is a “Database” connector, meaning it retrieves data from databases using a query. In the Data Center, you can access the connector page for this and other Database connectors by clicking Database in the toolbar at the top of the window. You connect to your PostgreSQL database in the Data Center. This topic discusses the fields and menus that are specific to the PostgreSQL SSH connector user interface. General information for adding DataSets, setting update schedules, and editing DataSet information is discussed in Adding a DataSet Using a Connector.
Note: Depending on your network’s structure, your IT administrator may need to whitelist any IP addresses necessary for the data connector to retrieve data. Contact your IT administrator for assistance.

Primary Use Cases

This connector is appropriate for pulling database information into Domo.

Primary Metrics

N/A

Primary Company Roles

  • IT

  • Project management

Average Implementation Time

~10 hours

Ease of Use (on a 1-to-10 scale with 1 being easiest)

9

Best Practices

  • Use read-only queries only.
  • Use “Replace” instead of “Append.”

Prerequisites

To connect to a PostgreSQL database via an SSH tunnel and create a DataSet, you must have the following:
  • The username and password you use to log into your PostgreSQL database
  • The name of the PostgreSQL database
  • The port number for the PostgreSQL database
  • The PostgreSQL database hostname or IP address
  • The UNIX server to SSH-tunnel through
  • The username and password for the UNIX account
  • The SSH port number
  • The SSH private key (either DES or RSA)
Before you can connect to a PostgreSQL database, you must also whitelist a number of IP addresses on your database server on the port you want to connect to. For the full list of IP addresses, see Whitelisting IP Addresses for Connectors.
Note: Domo does not support the SSH keys generated using ssh-keygen. The SSH keys need to be the DES or RSA keys generated by OpenSSL.

Connecting to Your PostgreSQL Database

This section enumerates the options in the Credentials and Details panes in the PostgreSQL SSH Connector page. The components of the other panes in this page, Scheduling and Name & Describe Your DataSet, are universal across most connector types and are discussed in greater length in Adding a DataSet Using a Connector.

Credentials Pane

This pane contains fields for entering credentials to connect to your database and SSH server. The following table describes what is needed for each field:

Field

Description

SSH Server Hostname

Enter the hostname of the UNIX server to SSH-tunnel through.

SSH Username

Enter the SSH username for your UNIX account.

SSH Password

Enter the SSH password username for your UNIX account.

SSH Port

Enter the port number for your UNIX account.

Database Hostname

Enter the host name for the PostgreSQL database. For example: db.company.com

SSH Private Key

Enter the SSH private key (either DES or RSA).

Database Name

Enter the PostgreSQL database name.

Database Username

Enter your PostgreSQL username.

Database Password

Enter your PostgreSQL password.

Database Port

Enter your PostgreSQL port number.

Once you have entered valid credentials, you can use the same account any time you go to create a new PostgreSQL SSH DataSet. You can manage connector accounts in the Accounts tab in the Data Center. For more information about this tab, see Manage Connector Accounts.

Details Pane

In this pane you create an SQL query to pull data from your database.

Menu

Description

Query Type

Custom Query Enter a customized SQL query with or without parameter to run.
Query Builder Build an SQL query by selecting the database table and table columns.

Database Tables

Select the database table you want to view in your report. This field appears when you select Query Builder as the Query Type .

Table Columns

Select all the table columns you want to view in your report.

Query Helper

Edit the query if required.

SQL Query

Enter the Structured Query Language (SQL) query to select the data you want.

Incremental Pull

The incremental pull option enables smaller dataset to be pulled from a database table as per variable tag!! and a last value or max value logic option. Dates should include single quotes around the variable tag such as ’!!’, while integers and decimals can remain without a single quote.

Last value : populate the variable in the query with the last value for the column to be pulled into Domo.

Max value : populates the variable in the query with the max value for that column from the last time the dataset ran.

The syntax for the variable is!!, column being the dataset column to be queried and the incremental pull logic acted against.

Default Value is used in the!! for only the first run of the dataset.

For example query: Select * from table where date > ’!!’ and the max value incremental pull option is selected. The connector uses the max date saved from the previous run for the date column, inserts that date into the query, and then runs the query against the database. All the data with a date greater than the max date would be pulled into Domo.

Default Value

Replaces the!! macro for the first run of the dataset. This field appears when you select Max value or Last value from the Incremental Pull drop-down list.

Fetch Size

Enter the fetch size for the memory performance. If the field is blank, then the default value becomes 400. If it throws out of memory for a value, then decrease the fetch size.

Keep big ints as integers

Select this checkbox to keep big ints as integers. Otherwise, big ints will be converted to floating decimals.

Troubleshooting

  • Make sure the appropriate IP addresses are whitelisted (see Prerequisites for a list of IP addresses).
  • Try decreasing fetch size or leave it empty.