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.9 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. Harlequin 2.10 and later also mask this option in configuration output and prompts.

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.1.tar.gz (10.8 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.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: harlequin_h2-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 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.1.tar.gz
Algorithm Hash digest
SHA256 2efcc82f71ee14b58b58861b979a75a1359685c408222ea4ec9dcb53b7716fb3
MD5 8f3778fc10b4395a4b73a1c6fdccae18
BLAKE2b-256 78598c02164eb89c9823b56940bf7dea45dc87d8ba042d0c8c5baf3d1af2f239

See more details on using hashes here.

Provenance

The following attestation bundles were made for harlequin_h2-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: harlequin_h2-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c456dd280f882f5242f665c8886a904db38246a9e00d10f9aa2ae034d51f3835
MD5 74630cd63cea541f52ece747bec87787
BLAKE2b-256 ac81bbf9ea4eff37d3790ffd42d8530d8a1b4f6548c5f30bfd3d9ce9f5782ae5

See more details on using hashes here.

Provenance

The following attestation bundles were made for harlequin_h2-0.1.1-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

This release

0.1.1 This release

2 files

0.1.0

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