2025-02-24 20:22:59 +01:00
# harlequin-postgres
2025-03-04 08:16:25 +01:00
This project provides the Harlequin adapter for Postgres. For more information, see [harlequin.sh ](https://harlequin.sh/docs/postgres/index ).
2025-02-24 20:22:59 +01:00
2025-03-04 08:16:25 +01:00
## Installation
2025-02-24 20:22:59 +01:00
2025-03-04 08:16:25 +01:00
You must install the `harlequin-postgres` package into the same environment as `harlequin` . The best and easiest way to do this is to use `uv` to install Harlequin with the `postgres` extra:
2025-02-24 20:22:59 +01:00
```bash
2025-03-04 08:16:25 +01:00
uv tool install 'harlequin[postgres]'
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
## Using Harlequin with Postgres
To connect to a Postgres database, run Harlequin with the `-a postgres` option and pass a [Posgres DSN ](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING ) as an argument:
2025-02-24 20:22:59 +01:00
```bash
2025-03-04 08:16:25 +01:00
harlequin -a postgres "postgres://my-user:my-pass@localhost:5432/my -database"
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
## Connection Options
2025-02-24 20:22:59 +01:00
2025-03-04 08:16:25 +01:00
You can also pass all or parts of the connection string as separate options. The following is equivalent to the above DSN:
2025-02-24 20:22:59 +01:00
```bash
2025-03-04 08:16:25 +01:00
harlequin -a postgres -h localhost -p 5432 -U my-user --password my-pass -d my-database
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
The supported connection options are:
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
host
port
dbname
user
password
passfile
require_auth
channel_binding
connect_timeout
sslmode
sslcert
sslkey
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
For descriptions of each option, run:
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
harlequin --help
2025-02-24 20:22:59 +01:00
```
2025-03-04 08:16:25 +01:00
## Environment Variables
2025-02-24 20:22:59 +01:00
2025-03-04 08:16:25 +01:00
Harlequin's Postgres driver will load connection information from the standard `PG*` environment variables. Any options supplied at the command-line will override environment variables.
2025-02-24 20:22:59 +01:00
## Manual Transactions
To use Manual transaction mode, click on the label in the Run Query Bar to toggle the transaction mode from Auto to Manual.
## Further Documentation
For more information, see the [Harlequin Docs ](https://harlequin.sh/docs/postgres/index ).