> ## Documentation Index
> Fetch the complete documentation index at: https://oxy.tech/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect with psql

> Connection parameters for Airhouse and how to use psql with it.

Airhouse accepts connections from any Postgres client over the standard wire protocol. `psql` uses the simple query protocol, which Airhouse supports completely, so it's the most reliable way to explore your data.

## Connection parameters

| Parameter | Value |
| - | - |
| Host | Your Airhouse host (`localhost` for a local stack) |
| Port | `5445` (default) |
| Database | Your Airhouse database name, for example `demo` |
| User / password | A user created for that database, or a short-lived credential from a [service account](../guides/service-accounts) |
| SSL | `sslmode=require` when the server has TLS enabled |

Airhouse uses the Postgres `database` parameter to pick your Airhouse database. If the database doesn't exist, the connection fails with `database "..." does not exist` (SQLSTATE `3D000`).

## Connect

```bash theme={null}
psql "host=localhost port=5445 dbname=demo user=alice"
```

The same connection as a URL:

```bash theme={null}
psql "postgresql://alice@localhost:5445/demo"
```

With TLS enabled on the server:

```bash theme={null}
psql "host=airhouse.example.com port=5445 dbname=demo user=alice sslmode=require"
```

<Tip>
  Set `PGPASSWORD` (or use a `~/.pgpass` file) to avoid the password prompt in scripts.
</Tip>

## Meta-commands

These psql meta-commands are supported:

| Command | Shows |
| - | - |
| `\dt` | Tables in the `lake` catalog |
| `\dn` | Schemas in the `lake` catalog |
| `\l` | Catalogs visible to your session |

To see the columns of a table, use DuckDB's `DESCRIBE` or `information_schema`:

```sql theme={null}
DESCRIBE lake.main.customers;

SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_schema = 'main' AND table_name = 'customers';
```

Command tags work as in Postgres, for example `INSERT 0 2`, `UPDATE 1`, `SELECT 3`, and `CREATE TABLE`.

## Load data from a local file

Use psql's `\copy` to stream a local CSV file into a table:

```sql theme={null}
CREATE TABLE lake.main.customers (id INTEGER, name TEXT, country TEXT);
\copy lake.main.customers FROM 'customers.csv' WITH (FORMAT csv, HEADER true)
```

`\copy` sends the file over the connection with `COPY ... FROM STDIN`, so the file only needs to exist on your machine. Loading data requires the `writer` or `admin` role.

## Run a single statement

```bash theme={null}
psql "host=localhost port=5445 dbname=demo user=alice" \
  -c "SELECT count(*) FROM lake.main.customers"
```

## Next steps

* [Drivers](./drivers): Python, Node.js, Go, and Java
* [BI and SQL tools](./bi-tools): DBeaver, Tableau, and other GUI clients


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.