> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-openapi-sync-dataflows.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL Connector

## Intro

PostgreSQL is a widely used open-source relational database management system. You can use Domo's PostgreSQL Connector to pull data from your PostgreSQL database 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/](https://www.postgresql.org/docs/ "https://www.postgresql.org/docs/") )

The PostgreSQL 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 connector user interface. General information for adding DataSets, setting update schedules, and editing DataSet information is discussed in [Adding a DataSet Using a Connector](https://domo-support.domo.com/s/article/360042926274?language=en_US "Adding a DataSet Using a Connector").

<Note>
  **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.
</Note>

<table class="mt-responsive-table" data-aura-rendered-by="33:201;a"><tbody><tr><td class="mt-noheading" colspan="1" rowspan="1"><p><b> Primary Use Cases </b></p></td><td class="mt-noheading" colspan="1" rowspan="1"><p> This connector is appropriate for pulling database information into Domo. </p></td></tr><tr><td class="mt-noheading" colspan="1" rowspan="1"><p><b> Primary Metrics </b></p></td><td class="mt-noheading" colspan="1" rowspan="1"><p> N/A </p></td></tr><tr><td class="mt-noheading" colspan="1" rowspan="1"><p><b> Primary Company Roles </b></p></td><td class="mt-noheading" colspan="1" rowspan="1"><ul><li><p> IT </p></li><li><p> Project management </p></li></ul></td></tr><tr><td class="mt-noheading" colspan="1" rowspan="1"><p><b> Average Implementation Time </b></p></td><td class="mt-noheading" colspan="1" rowspan="1"><p> \~10 hours </p></td></tr><tr><td class="mt-noheading" colspan="1" rowspan="1"><p><b> Ease of Use (on a 1-to-10 scale with 1 being easiest) </b></p></td><td class="mt-noheading" colspan="1" rowspan="1"><p> 9 </p></td></tr></tbody></table>

## Best Practices

* Use read-only queries only.
* Use "Replace" instead of "Append."

## Prerequisites

To connect to a PostgreSQL database and create a DataSet, you must have the following:

* The username and password you use to log into your PostgreSQL database
* The host name for the database
* The port number for the database
* The database name

CA certificate text or URL path is required *only* if you select **Certificate text** or **URL path**, respectively, in the **Certificate type** menu.

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](/s/article/360043630093 "Whitelisting IP Addresses for Connectors").

## Connecting to Your PostgreSQL Database

This section enumerates the options in the **Credentials** and **Details** panes in the PostgreSQL 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](https://domo-support.domo.com/s/article/360042926274?language=en_US "Adding a DataSet Using a Connector").

### Credentials Pane

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

<table border="1" cellpadding="1" cellspacing="1" data-aura-rendered-by="33:195;a"><thead><tr><th colspan="1" rowspan="1"><p> Field </p></th><th colspan="1" rowspan="1"><p> Description </p></th></tr></thead><tbody><tr><td colspan="1" rowspan="1"><p> Username </p></td><td colspan="1" rowspan="1"><p> Enter your PostgreSQL username. </p></td></tr><tr><td colspan="1" rowspan="1"><p> Password </p></td><td colspan="1" rowspan="1"><p> Enter your PostgreSQL password. </p></td></tr><tr><td colspan="1" rowspan="1"><p> Host </p></td><td colspan="1" rowspan="1"><p> Enter the host name for the SQL database. For example: <span class="mt-font-courier-new"><a href="http://db.company.com" rel="noopener" target="_blank"> db.company.com </a></span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Port </p></td><td colspan="1" rowspan="1"><p> Enter the port number for the database. </p></td></tr><tr><td colspan="1" rowspan="1"><p> Certificate </p></td><td colspan="1" rowspan="1"><p> Paste the text for your CA certificate or enter the URL where your certificate is located. This is optional. If you do not want to include a certificate, select <b> No certificate </b> in the <b> Certificate Type </b> menu. </p></td></tr><tr><td colspan="1" rowspan="1"><p> Certificate Type </p></td><td colspan="1" rowspan="1"><p> Select a certificate type. If you do not want to include a certificate, select <b> No certificate </b>. If you select Certificate text, you must paste the text for your certificate in the <b> Certificate </b> field. If you select <b> URL path </b>, you must enter the URL where your certificate is located in the <b> Certificate </b> field. </p></td></tr><tr><td colspan="1" rowspan="1"><p> Database </p></td><td colspan="1" rowspan="1"><p> Enter the name of the SQL database. </p></td></tr></tbody></table>

Once you have entered valid PostgreSQL credentials, you can use the same account any time you go to create a new PostgreSQL DataSet. You can manage connector accounts in the **Accounts** tab in the Data Center. For more information about this tab, see [Manage Connector/Adapter Accounts](https://domo-support.domo.com/s/article/360042926054?language=en_US "Manage Connector/Adapter Accounts").

### Details Pane

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

<table border="1" cellpadding="1" cellspacing="1" data-aura-rendered-by="33:201;a"><thead><tr><th colspan="1" rowspan="1"><p> Menu </p></th><th colspan="1" rowspan="1"><p> Description </p></th></tr></thead><tbody><tr><td colspan="1" rowspan="1"><p> Query Type </p></td><td colspan="1" rowspan="1"><p> Select a query type </p><table class="zebra-striped bordered"><tbody><tr><th colspan="1" rowspan="1"> Query Type </th><th colspan="1" rowspan="1"> Description </th></tr><tr><td colspan="1" rowspan="1"> Query Builder </td><td colspan="1" rowspan="1"><span class="x x-first x-last"> Build an </span><span> SQL query </span><span class="x x-first x-last"> by selecting the database table and table columns </span></td></tr><tr><td colspan="1" rowspan="1"> Custom Query </td><td colspan="1" rowspan="1"><span class="x x-first x-last"> Enter a customized </span><span> SQL query </span><span class="x x-first x-last"> with or </span><span> without parameters </span><span class="x x-first x-last"> to execute </span></td></tr></tbody></table></td></tr><tr><td colspan="1" rowspan="1"><p> SQL Query </p></td><td colspan="1" rowspan="1"><p> Enter the Structured Query Language (SQL) query to use in selecting the data you want. For example: </p><p><span class="mt-font-courier-new"> select \* from Employee </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Query Parameter (Check box) </p></td><td colspan="1" rowspan="1"><p><span> Select this checkbox to add query parameters. </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Query Parameter (Text box) </p></td><td colspan="1" rowspan="1"><p><span> Enter the query parameter value. It is the initial value for query parameter. The last run date is optional. By default it is '02/01/1700' if is not provided. Example: </span> `!{lastvalue:_id}!=1,!{lastrundate:start_date}!=02/01/1944` </p></td></tr><tr><td colspan="1" rowspan="1"> Fetch Size </td><td colspan="1" rowspan="1"><span> Enter fetch size for memory performance. If it is blank, default value will be 400. </span></td></tr><tr><td colspan="1" rowspan="1"><p> BigInt To Long </p></td><td colspan="1" rowspan="1"><p><span> Select to always convert a bigint column to a long column in Domo. </span><br /><span> This means even if the bigint column stores small integer values, Domo will still consider the column to have long values. </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Disable Statement Timeout </p></td><td colspan="1" rowspan="1"><p><span> Select, this checkbox if you observe errors for statement timeout. </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Database Table </p></td><td colspan="1" rowspan="1"><p><span> Select the database table you want to appear in your report. </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Table Columns </p></td><td colspan="1" rowspan="1"><p><span> Select the table columns you want to appear in your report. </span></p></td></tr><tr><td colspan="1" rowspan="1"><p> Query Helper </p></td><td colspan="1" rowspan="1"><p> Copy and paste this query into the <b> Query </b> field if you need help building a query. This query is automatically generated when you select a table and columns in the <b> Database Table </b> and <b> Table Columns </b> fields, respectively. </p></td></tr></tbody></table>

### Other Panes

For information about the remaining sections of the connector interface, including how to configure scheduling, retry, and update options, see [Adding a DataSet Using a Connector](https://domo-support.domo.com/s/article/360042926274?language=en_US "Adding a DataSet Using a Connector").

## 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.
