Pure Python HSQLDB hsql:// client with no JVM, JDBC, or runtime jar dependency.
Project description
pure-hsqldb-client
pure-hsqldb-client is a pure Python HSQLDB wire-protocol client for HSQLDB 2.x hsql:// server mode.
It opens a TCP socket and speaks the HSQLDB result/row protocol directly. Runtime use does not start a JVM, import JDBC bindings, shell out to Java, or require hsqldb.jar.
What This Is Not
- Not a JDBC wrapper.
- Not a JVM bridge.
- Not an embedded HSQLDB engine.
- Not a claimed full clone of every HSQLDB client feature.
Compatibility is documented from the test matrix below. Features not covered by tests are listed as partial or unsupported.
Install
From Git:
python -m pip install "git+https://github.com/<owner>/<repo>.git"
From PyPI after publication:
python -m pip install pure-hsqldb-client
With uv from Git:
uv add "git+https://github.com/<owner>/<repo>.git"
With uv after publication:
uv add pure-hsqldb-client
Basic Usage
import os
from pure_hsqldb import HSQLDB
url = "hsql://<host>:<port>/<database>"
user = os.environ["HSQLDB_USER"]
password = os.environ.get("HSQLDB_PASSWORD", "")
with HSQLDB.from_url(url, user=user, password=password) as db:
rows = db.fetchall("VALUES 1")
print(rows)
JDBC-form HSQLDB URLs are also accepted for compatibility:
url = "jdbc:hsqldb:hsql://<host>:<port>/<database>"
Credentials in URLs are rejected. Pass them separately.
Database aliases parsed from URLs are normalized to lowercase before CONNECT. This matches common HSQLDB server alias configuration and avoids case-only URL mismatches.
DB-API Style Usage
import os
from pure_hsqldb.dbapi import connect
conn = connect(
url="hsql://<host>:<port>/<database>",
user=os.environ["HSQLDB_USER"],
password=os.environ.get("HSQLDB_PASSWORD", ""),
)
try:
cur = conn.cursor()
cur.execute("VALUES CAST(? AS INTEGER)", [123])
print(cur.fetchone())
finally:
conn.close()
paramstyle is qmark. Parameterized execution uses server-side prepare/execute.
CLI
Do not pass credentials directly as command-line arguments. Use an environment variable, stdin, or an interactive prompt.
export HSQLDB_URL='hsql://<host>:<port>/<database>'
export HSQLDB_USER='<username>'
export HSQLDB_PASSWORD='<password>'
pure-hsqldb \
--url "$HSQLDB_URL" \
--user "$HSQLDB_USER" \
--password-env HSQLDB_PASSWORD \
--sql 'VALUES 1' \
--json
Interactive prompt:
pure-hsqldb \
--url "$HSQLDB_URL" \
--user "$HSQLDB_USER" \
--prompt-password \
--sql 'VALUES 1'
Security Notes
- No JAR is bundled in the package.
- Runtime code does not import JPype, JayDeBeApi, JDBC, or Java subprocesses.
- CLI has no raw password argument.
repr(HSQLDB(...))redacts the password field.- URL credentials are rejected to avoid leaking sensitive values through logs and process lists.
- Tests use environment-provided integration credentials.
Compatibility Matrix
| Area | Status | Evidence |
|---|---|---|
| TCP connect and HSQLDB handshake | Tested | Integration server started from local hsqldb.jar |
| CONNECT / CONNECTACKNOWLEDGE | Tested | Login success and failure tests |
| Direct SQL execution | Tested | Scalar, DDL, INSERT, UPDATE, DELETE |
| Server-side prepare / execute | Tested | ? parameter tests and prepared insert/query |
| SQL functions and procedures | Tested | CREATE FUNCTION, CREATE PROCEDURE, CALL, routine error path |
| DB-API cursor | Tested | execute, executemany, fetchone, fetchmany, fetchall |
| Result modes | Partial | Tested DATA, DATAROWS, UPDATECOUNT, ERROR; other modes parsed when known |
| Multi-block fetch | Tested | Fetch sizes 0, 1, small, larger-than-result |
| Transactions | Tested | Autocommit control, commit, rollback |
| Clean close | Tested indirectly | Context managers and integration teardown |
| Malformed payload handling | Unit tested | Short buffer and invalid modified UTF |
| Thread safety | Documented only | DB-API threadsafety = 1; share connections carefully |
Supported Types
| HSQLDB type | Python representation | Status |
|---|---|---|
| NULL | None |
Unit tested |
| BOOLEAN | bool |
Unit/integration tested |
| TINYINT, SMALLINT, INTEGER, BIGINT | int |
Unit/integration tested |
| REAL, FLOAT, DOUBLE | float |
Unit/integration tested |
| NUMERIC, DECIMAL | decimal.Decimal |
Unit/integration tested |
| CHAR, VARCHAR, VARCHAR_IGNORECASE, national text types | str |
Unit/integration tested for VARCHAR |
| BINARY, VARBINARY, LONGVARBINARY | bytes |
Unit/integration tested for VARBINARY |
| BIT, BIT VARYING | pure_hsqldb.types.BitString |
Unit/integration tested |
| DATE | datetime.date |
Unit/integration tested |
| TIME | datetime.time |
Unit/integration tested |
| TIME WITH TIME ZONE | timezone-aware datetime.time |
Integration tested |
| TIMESTAMP | datetime.datetime |
Unit/integration tested |
| TIMESTAMP WITH TIME ZONE | timezone-aware datetime.datetime |
Integration tested |
| INTERVAL YEAR/MONTH/YEAR TO MONTH | IntervalMonth |
Unit/integration tested |
| INTERVAL DAY through MINUTE TO SECOND | IntervalSecond |
Unit/integration tested for DAY TO SECOND |
| ARRAY | tuple |
Unit/integration tested for scalar arrays |
| BLOB/CLOB locators | LobRef |
Parser support; not integration-proven |
| OTHER/JAVA_OBJECT | bytes or explicit unsupported path |
Partial |
| UUID | bytes |
Parser support; not integration-proven |
Unsupported Or Partial
- HTTP transport and TLS transport are not implemented.
- Full LOB streaming operations are not implemented.
- Batch protocol modes are parsed, but DB-API
executemanycurrently loops prepared executions. - Nested arrays are not integration-proven.
- Generated keys are not exposed as a high-level API.
- Warnings are parsed as chained results but not promoted to a DB-API warning collection.
- Full metadata nullability/display-size semantics are not yet mapped.
Development
python -m pip install -e .
python -m pytest
Integration tests need a local HSQLDB JAR and credentials supplied through the environment:
export HSQLDB_JAR='/path/to/hsqldb.jar'
export HSQLDB_TEST_USER='<username>'
export HSQLDB_TEST_PASSWORD='<password>'
python -m pytest -m integration
The JAR is only used to start a throwaway test server. It is not packaged.
External write smoke tests can be run against a server you control. They create temporary objects with random names and clean them up afterwards:
export HSQLDB_EXTERNAL_URL='hsql://<host>:<port>/<database>'
export HSQLDB_EXTERNAL_USER='<username>'
export HSQLDB_EXTERNAL_PASSWORD='<password>'
export HSQLDB_EXTERNAL_WRITE_TESTS=1
python -m pytest -m external
Verification
./verify.sh
The script runs compile checks, unit tests, security grep gates, build, wheel content inspection, clean-venv import smoke, and CLI smoke.
Publishing With uv
uv build
uv publish
Before publishing, run ./verify.sh and inspect dist/.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pure_hsqldb_client-0.3.0.tar.gz.
File metadata
- Download URL: pure_hsqldb_client-0.3.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83aa46400e34916d02ad1e3800720fb3d04f40782b6be95d13fb9f85f38acc7c
|
|
| MD5 |
7fe67a0da847f17e62f9bf04dd14fcc4
|
|
| BLAKE2b-256 |
8eb9272bc56bc3a7a321c9aaf64f7b2e3489c17f6ebee1c9f16d42ed874ccc95
|
File details
Details for the file pure_hsqldb_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pure_hsqldb_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f5ad28a343f47f1d4ffaf0ca7769499be67f8fbaa5b8feaf8d2cc261f7d66d2
|
|
| MD5 |
ef57e671aa5b92928b39a70143c3e6b4
|
|
| BLAKE2b-256 |
830d6c4fa7c1da24a00c09834ce6e0e8cf37594e9cd866ae4c32a136570eb05f
|