Esc
Documentation
On this page

The PostgreSQL adapter connects to a PostgreSQL server with structured settings. It has a single connection method, so you don’t set method.

Add a PostgreSQL service#

Declare the adapter and the service in dsui.yaml:

yaml
adapters:
  postgresql:
    source: git
    repository: "git+https://github.com/northgraindata/dsui"
    path: packages/adapter-postgresql

services:
  - id: app-database
    adapter: postgresql
    name: Application database
    connection:
      host: postgres
      port: 5432
      database: app
      username: ${POSTGRES_USER}
      password: ${POSTGRES_PASSWORD}

In Docker Compose, use the service name of the PostgreSQL container as host. localhost is the DSUI container itself. See connect a service for how credentials work.

Connection fields#

FieldRequiredDefaultMeaning
hostYesHost name or address of the server
portNo5432Port of the server
databaseYesThe database DSUI connects to first
databaseScopeNoallall lists every database the user can access. selected shows only database
usernameYesRole to sign in with
passwordNoNonePassword of the role
sslModeNopreferdisable, prefer, require, verify-ca, or verify-full. The two verify modes check the server certificate
sslRootCertNoNoneCertificate authority certificate, as PEM text
sslCertNoNoneClient certificate, as PEM text
sslKeyNoNoneClient private key, as PEM text
connectTimeoutNo10Seconds to wait for a connection
statementTimeoutNo60000Milliseconds before the server stops a statement
applicationNameNodsuiName that DSUI reports to PostgreSQL, visible in pg_stat_activity

The certificate fields take the certificate text itself, not a file path.

What you can do#

  • Overview: database size, and counts of schemas, tables, views, indexes, and active connections
  • Data: browse databases, schemas, and relations, and open a relation to see its columns, indexes, constraints, and a preview of its rows
  • Query: write and run SQL against any database that the scope allows. A query returns at most 1,000 rows by default, and never more than 10,000
  • Activity: see running queries and connection usage, and cancel a query after you confirm

Signals#

Running a query in DSUI emits the signal query-succeeded or query-failed. The payload holds the operation, the database, the duration in milliseconds, and the row count or the error code. It never includes the query text. Plugins can react to these signals. Queries that other clients run don’t emit signals, although Activity can show some of them while they run.

Use with a DSUI Agent#

The adapter connects through a DSUI Agent. Choose Via DSUI Agent in the connection dialog, and enter the host and port as the agent sees them. See private networks.