Creating a connection to PostgreSQL in DataLens On-premises

To create a PostgreSQL connection:

  1. Go to the workbook page or create a new one.

  2. In the top-right corner, click CreateConnection.

  3. Select the PostgreSQL connection.

  4. Specify the connection parameters for the external PostgreSQL database:

    • Host name: 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 fail 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 database name.
    • Username: Specify a username for the PostgreSQL connection.
    • Password: Specify a password for the user.
    • Cache TTL in seconds: Specify cache TTL 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. This option is disabled by default. When enabling it, you will need to select the raw SQL level:

      • Subqueries only: Describe dataset sources using SQL queries.
      • Subqueries and parameters: Describe dataset sources using SQL queries and use source parameterization.
      • SQL to read: Describe dataset sources using SQL queries, use source parameterization, create QL charts, and execute read-only SQL queries.
  5. Optionally, test the connection by clicking Check connection.

  6. Click Create connection.

  7. Enter a name for the connection and click Create.

Additional settings

You can specify additional connection settings under Advanced connection settings:

  • Setting collate in a query: To explicitly define a collation for database queries, select a mode:

    • Auto: Applies the default setting. DataLens decides whether to enable the en_US locale.
    • On: Applies the DataLens setting. The en_US locale is specified for individual expressions within a query. Thus the server uses the appropriate sorting logic, regardless of the server settings and specific tables. Use the DataLens setting if your database locale is incompatible with DataLens.
    • Off: Applies the default setting. DataLens only uses database-level locale settings.
  • TLS: Indicates whether TLS is required. When the option is enabled, the sslmode parameter is set to required. When the option is disabled, the parameter is set to prefer.

  • 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 on, the data export item will not be available in the menu for the charts based on this connection. However, you will still be able to copy chart data and take screenshots.