Skip to main content

harlequin-h2

PyPI CI

A Harlequin adapter for H2 databases via JDBC. It supports embedded file and memory databases as well as H2 TCP and TLS servers.

The adapter embeds the JVM with JPype and talks to H2 directly. File and memory connections do not require a database server, protocol bridge, or fixed port.

Requirements

  • Python 3.10 or later
  • Harlequin 2.10 or later, below 3.0
  • H2 2.x
  • A Java runtime compatible with your H2 version
  • The H2 JDBC driver JAR

Installation

Install H2 and add this adapter to the same environment as Harlequin:

brew install h2
uv tool install harlequin --with harlequin-h2

If Harlequin is already installed with uv, add the adapter to that tool environment:

uv tool install harlequin --with harlequin-h2 --force

The adapter finds Homebrew's H2 JAR automatically. On other platforms, pass --jar or set H2_JAR:

export H2_JAR=/path/to/h2.jar

Usage

Embedded file database

harlequin -a h2 -U sa \
  "jdbc:h2:file:/absolute/path/to/database;AUTO_SERVER=TRUE;IFEXISTS=TRUE"

AUTO_SERVER=TRUE allows Harlequin and another JVM process to share the file. Use IFEXISTS=TRUE when inspection must never create a new empty database due to a mistyped path.

Embedded memory database

harlequin -a h2 "jdbc:h2:mem:demo"

A named embedded memory database normally exists until its last connection is closed. Add ;DB_CLOSE_DELAY=-1 only when it must survive connection closure; H2 then retains it until SHUTDOWN or process exit.

TCP or TLS server

harlequin -a h2 -U sa "jdbc:h2:tcp://localhost/~/demo"
harlequin -a h2 -U sa "jdbc:h2:ssl://db.example.com/~/demo"

Options

Option Description
--jar PATH Path to the H2 JDBC driver JAR
-U, --user USER H2 username; defaults to sa
--password PASSWORD H2 password; defaults to an empty string

Prefer a protected Harlequin profile or an environment-variable reference for passwords. Command-line arguments may be visible to other local processes.

Environment variables in the JDBC URL are expanded before connecting:

export H2_DATABASE_DIR=/absolute/path/to/databases
harlequin -a h2 'jdbc:h2:file:$H2_DATABASE_DIR/demo;IFEXISTS=TRUE'

Features

  • Query execution and result display
  • Lazy schema, table, view, and column catalog
  • Data preview, column insertion, relation description, and DDL actions
  • Safe query execution and result fetching across Harlequin worker threads

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harlequin_h2-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harlequin_h2-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file harlequin_h2-0.1.0.tar.gz.

File metadata

  • Download URL: harlequin_h2-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for harlequin_h2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 174b6274f73af8328b6f38d88e294ed73ec67fddc74b032d52ad7bbe8d37ef5b
MD5 2d93d7c8b210eb257ccb7c0bae132139
BLAKE2b-256 87591d7330372991356a88bcbd5d5875a602112c6c2e82a1cd4a359e6e9c5693

See more details on using hashes here.

Provenance

The following attestation bundles were made for harlequin_h2-0.1.0.tar.gz:

Publisher: publish.yml on clang-engineer/harlequin-h2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harlequin_h2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: harlequin_h2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for harlequin_h2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e3a35698b42644112d5aee72d171e6c0029b7f8f96b1679c55050ab637b480e
MD5 ae4cb76d1f7331b505a954879eb3844f
BLAKE2b-256 1cfed853bcacea8d2186923a7db063703401b39f212be3a3e8fc199698e5741f

See more details on using hashes here.

Provenance

The following attestation bundles were made for harlequin_h2-0.1.0-py3-none-any.whl:

Publisher: publish.yml on clang-engineer/harlequin-h2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page