# harlequin

> Terminal-based SQL IDE with database adapter support for DuckDB, SQLite, PostgreSQL, MySQL and dozens of other databases

Stars: 6.5k · Language: Python · License: MIT · Categories: Dev Tools

- Repository: https://github.com/tconbeer/harlequin
- Website: https://harlequin.sh
- Page: https://www.trmn.sh/tools/harlequin

## Install

- UV: `uv tool install harlequin`
- Pip: `pip install harlequin`
- Homebrew: `brew install harlequin`

## Overview

Harlequin is a terminal-based SQL IDE that provides an interactive interface for querying databases. It runs entirely in the terminal and supports dozens of different databases through adapter plug-ins, including built-in support for DuckDB and SQLite. Users can open databases by specifying connection strings, execute SQL queries, browse data catalogs, and export data.

The tool uses a modular adapter system where each database type is supported through separate Python packages. Popular adapters include PostgreSQL, MySQL/MariaDB, S3, and ODBC connections. Adapters can be installed as extras during installation or separately afterward. Each adapter defines its own connection options and capabilities that appear in the help system.

Harlequin supports extensive customization through configuration files, allowing users to set themes, customize key bindings, configure file pickers for local and remote files, and define connection profiles. The tool includes Django integration through the django-harlequin package, which enables launching Harlequin with Django's database configuration. It runs on Linux, macOS, and Windows and requires Python 3.9 or above.

### Installation

```bash
# via UV
uv tool install harlequin
```

```bash
# via Pip
pip install harlequin
```

```bash
# via Homebrew
brew install harlequin
```

## Alternatives

- [Azure CLI](https://www.trmn.sh/tools/azure-cli.md): Microsoft's cross-platform command-line interface for managing Azure resources with az group/subgroup/command syntax, JMESPath queries, and tab completion. (Python, 4.7k stars)
- [GDB dashboard](https://www.trmn.sh/tools/gdb-dashboard.md): A standalone .gdbinit written in Python that shows a modular dashboard of program state in GDB each time the debugged program stops. (Python, 12.3k stars)
- [textual-astview](https://www.trmn.sh/tools/textual-astview.md): TUI tool for exploring Python Abstract Syntax Trees (AST) with interactive tree view and source highlighting (Python, 100 stars)
- [peplum](https://www.trmn.sh/tools/peplum.md): Terminal-based browser and search interface for Python Enhancement Proposals (PEPs) (Python, 27 stars)
- [AWS CLI](https://www.trmn.sh/tools/aws-cli.md): Official command line interface for Amazon Web Services, with profile-based credentials, configurable output, and shell tab completion. (Python, 17.3k stars)

## Guides

- [Best Database CLI Clients](https://www.trmn.sh/best/database-clients): Compare usql, pgcli, mycli, harlequin and lazysql for querying Postgres, MySQL and SQLite from the terminal, with notes on dblab.

---

Canonical: https://www.trmn.sh/tools/harlequin
