Creating a PostgreSQL connection
To create a PostgreSQL connection:
-
Go to the workbook page or create a new one.
-
In the top-right corner, click Create → Connection.
-
Select a PostgreSQL connection.
-
Specify the connection parameters for the external PostgreSQL database:
- Hostname: Specify the path to a master host or a PostgreSQL master host IP address. You can specify multiple hosts in a comma-separated list. If you are unable to connect to the first host, DataLens will select the next one from the list.
- Port: Specify the PostgreSQL connection port. In DataLens, the default port is 6432.
- Path to database: Specify the name of the database to connect to.
- Username: Specify the username for the PostgreSQL connection.
- Password: Enter the password for the user.
- Cache TTL in seconds: Specify the cache time-to-live or leave the default value. The recommended value is 300 seconds (5 minutes).
- Raw SQL level: Enables you to use an ad-hoc SQL query to generate a dataset.
-
(Optional) Make sure the connection works properly. To do this, click Check connection.
-
Click Create connection.
-
Enter a name for the connection and click Create.
Additional settings
You can specify additional connection settings in the Advanced connection settings section:
-
Setting collate in a query: To explicitly define a collation for DB queries, select a mode:
- Auto: The default setting is used, DataLens decides whether to enable the
en_US
locale. - On: The DataLens setting is used, the
en_US
locale is specified for individual expressions in a query. This makes the server use the appropriate sorting logic, regardless of the server settings and specific tables. Use the DataLens setting if the DB locale is incompatible with DataLens performance. - Off: The default setting is used, DataLens only uses the existing parameters of the DB locale.
- Auto: The default setting is used, DataLens decides whether to enable the
-
TLS: Indicates that TLS should be used. If the option is enabled, the
sslmode
parameter value isrequired
; if disabled, the parameter value isprefer
. -
CA Certificate: To upload a certificate , click Attach file and specify the certificate file. When the certificate is uploaded, the field shows the file name.
-
Disable data export: When this option is enabled, the export data button will be hidden in the charts based on this connection. However, you will still be able to copy chart data and take screenshots.