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

# CLI commands

> Reference for the Tamery CLI: login, logout, whoami, query, and proxy, with flags and examples.

Run `tamery --help` for a summary, or `tamery <command> --help` for one command.

***

## tamery login

Sign in. Opens the browser sign-in flow and saves the session locally. Times out after 5 minutes.

```bash theme={null}
tamery login [options]
```

<ParamField query="--force" type="boolean">
  Sign in even if already authenticated (switch accounts). Alias: `-f`.
</ParamField>

<ParamField query="--no-open" type="boolean">
  Don't open the browser; print the URL instead. Useful over SSH.
</ParamField>

```bash theme={null}
tamery login
tamery login --no-open
tamery login --force
```

```text theme={null}
✓ Signed in as user@example.com.
```

***

## tamery logout

Sign out and clear the local session.

```bash theme={null}
tamery logout
```

```text theme={null}
✓ Signed out.
```

***

## tamery whoami

Show the signed-in user. Prints `Not signed in.` if there's no session; an expired session is cleared automatically.

```bash theme={null}
tamery whoami
```

```text theme={null}
user@example.com
```

***

## tamery query

Run SQL against a saved connection. Provide SQL inline or via `--file`. Output is a formatted table, or JSON with `--json`.

Supports PostgreSQL, MySQL, MSSQL, and ClickHouse.

```bash theme={null}
tamery query [options] [sql]
```

<ParamField query="--connection" type="string">
  Connection ID or name. Required if you have more than one. Alias: `-c`.
</ParamField>

<ParamField query="--file" type="string">
  Path to a `.sql` file to run instead of inline SQL. Alias: `-f`.
</ParamField>

<ParamField query="--json" type="boolean">
  Output JSON instead of a table.
</ParamField>

<ParamField query="--list-connections" type="boolean">
  Print saved connections and exit.
</ParamField>

```bash theme={null}
tamery query -c my-db "SELECT * FROM users LIMIT 10"
tamery query -c my-db --file ./queries/report.sql
tamery query -c my-db --json "SELECT id, name FROM products"
tamery query --list-connections
```

<Note>Output includes execution time in milliseconds.</Note>

***

## tamery proxy

Start a local proxy so the web app can reach databases that aren't publicly accessible (localhost, private network, VPC). Credentials and traffic stay on your machine. Stop with <kbd>Ctrl</kbd>+<kbd>C</kbd>.

```bash theme={null}
tamery proxy
```

<Tip>
  You only need the proxy for databases not reachable from the internet. Public cloud endpoints work
  without it.
</Tip>
