Python wrapper that runs a GizmoSQL Flight SQL server as a subprocess (download-on-first-use, no compilation).
Project description
gizmosql
Run a GizmoSQL Flight SQL server as
a managed subprocess from Python — no compile toolchain required, no
ahead-of-time install step. The matching gizmosql_server binary is
downloaded from GitHub Releases on first use and cached under
~/.cache/gizmosql/.
📖 Full reference: docs.gizmosql.com/#/python_library — covers all Server() parameters, the pytest fixture pattern, the multi-agent pattern, environment variables, and limitations. This README is a quick tour; the docs page is the authoritative reference.
Why?
GizmoSQL is a network endpoint — Apache Arrow Flight SQL on top of DuckDB.
The point of running it from Python isn't to talk to it from the same
process (the duckdb package is better
at that), it's to expose a SQL endpoint to other things:
- pytest fixtures that exercise a real Flight SQL server in CI
- Multi-tool / multi-agent workflows where the Python process is the orchestrator and other tools (a JDBC driver, Power BI, AI agents, a separate worker) all connect to the same server
- Notebook demos that need a live server while showing client-side code
- "Expose this DuckDB file to the network" — three lines of Python and any Flight SQL client can query it
Install
pip install gizmosql
# or, with the optional ADBC client for Server.connect():
pip install 'gizmosql[adbc]'
The package itself has zero runtime dependencies. The gizmosql_server
binary is fetched on first use (~10 MB compressed); subsequent starts use
the cached copy.
Quick start
import gizmosql
with gizmosql.Server(password="tiger") as srv:
print(srv.url) # grpc+tcp://127.0.0.1:42173
print(srv.username, srv.password)
# ... point any Flight SQL client at srv.url ...
The context manager:
- Downloads the matching server binary on first use.
- Picks a free TCP port (so multiple parallel test workers don't collide).
- Starts the subprocess and blocks until it's accepting connections.
- SIGTERMs it on exit, escalating to SIGKILL if it doesn't respond.
From the same Python process (optional)
With the adbc extra, you can also query the server from the same Python
that started it:
import gizmosql
with gizmosql.Server(password="tiger") as srv:
with srv.connect() as conn, conn.cursor() as cur:
cur.execute("SELECT GIZMOSQL_VERSION(), GIZMOSQL_EDITION()")
print(cur.fetchall())
Common configurations
# Persistent on-disk database with the TPC-H sample loaded at startup.
gizmosql.Server(
password="tiger",
database_filename="warehouse.duckdb",
init_sql_commands="CALL dbgen(sf=1);", # ~1 GB on disk
)
# Pin the LTS channel (DuckDB LTS release).
gizmosql.Server(password="tiger", channel="lts")
# Pin a specific version (overrides the package's default version).
gizmosql.Server(password="tiger", version="v1.25.1")
# Listen on all interfaces (default is loopback only).
gizmosql.Server(password="tiger", host="0.0.0.0")
# Forward arbitrary CLI flags to gizmosql_server.
gizmosql.Server(
password="tiger",
extra_args=["--print-queries", "--query-log-level", "debug"],
)
See gizmosql_server --help (in the cached binary) for the full set of CLI
flags — anything passed via extra_args is forwarded verbatim.
Versioning
gizmosql==X.Y.Z ships in lock-step with the matching GizmoSQL server tag
vX.Y.Z — that's the version it'll download and run unless you override
with version="...". Python-only patches (rare) use PEP 440 .postN
suffixes, e.g. 1.25.1.post1.
pytest fixture pattern
# conftest.py
import pytest
import gizmosql
@pytest.fixture(scope="session")
def gizmosql_server(tmp_path_factory):
db = tmp_path_factory.mktemp("gizmosql") / "test.duckdb"
with gizmosql.Server(password="testpw", database_filename=str(db)) as srv:
yield srv
# test_my_app.py
def test_my_jdbc_client_can_query(gizmosql_server):
# Hand srv.url to whatever client you're testing.
my_client.connect(gizmosql_server.url, "gizmosql", "testpw")
...
The session scope reuses the server across the whole run; ports are
auto-picked, so parallel pytest-xdist workers don't collide.
Environment variables
| Variable | Purpose |
|---|---|
GIZMOSQL_CACHE_DIR |
Override the binary cache root (default: ~/.cache/gizmosql/ on POSIX, %LOCALAPPDATA%\gizmosql\Cache on Windows). |
GIZMOSQL_VERSION |
Default server version when Server(version=...) is unset. |
GIZMOSQL_RELEASE_REPO |
GitHub repo to download releases from (default gizmodata/gizmosql). |
GIZMOSQL_RELEASE_BASE_URL |
Full base URL override; for testing against a staging release page. |
Limitations
- Subprocess only (no in-process / FFI mode in v1). The server runs in its
own process and clients (including
Server.connect()) talk to it over the loopback Flight SQL endpoint. This is the right architecture for the intended use cases — see Why? above. - Pre-built binaries exist for: macOS arm64, Linux amd64, Linux arm64, Windows amd64. Other platforms aren't supported.
Links
- 📖 Python Library reference — full API + patterns
- 🌐 Product page
- 📦 Install picker (CLI, Homebrew, Docker, Python)
- 🚀 Quick Start guide
- 📚 GizmoSQL documentation
- 🦆 LTS Channel guide
- 🐛 Issues / requests
License
Apache-2.0, matching the main GizmoSQL project.
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 gizmosql-1.25.2.tar.gz.
File metadata
- Download URL: gizmosql-1.25.2.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd197147175e1c1becec4909e473fa74214f6783e9878bcb88439092911476a6
|
|
| MD5 |
dd34a6eff2cbd9a242de61897ab24554
|
|
| BLAKE2b-256 |
88628a90587104ca9528d546009631631ed0c5980b3beaa798f0476da80eb49e
|
Provenance
The following attestation bundles were made for gizmosql-1.25.2.tar.gz:
Publisher:
ci.yml on gizmodata/gizmosql-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gizmosql-1.25.2.tar.gz -
Subject digest:
cd197147175e1c1becec4909e473fa74214f6783e9878bcb88439092911476a6 - Sigstore transparency entry: 1475061447
- Sigstore integration time:
-
Permalink:
gizmodata/gizmosql-py@e1016ba0070d7c8f9ec177c4f67c8865c966db6c -
Branch / Tag:
refs/tags/v1.25.2 - Owner: https://github.com/gizmodata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e1016ba0070d7c8f9ec177c4f67c8865c966db6c -
Trigger Event:
push
-
Statement type:
File details
Details for the file gizmosql-1.25.2-py3-none-any.whl.
File metadata
- Download URL: gizmosql-1.25.2-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
916d39fbe65b5260c774f1adfc8150d89a336314e60c47f391f7989568d614a8
|
|
| MD5 |
453c87ddd01ffa144f4d4bb303c34230
|
|
| BLAKE2b-256 |
a7cba6de160b4b97669386c28881284812bbdcea9e3276f17b1f4a4cfd0bba89
|
Provenance
The following attestation bundles were made for gizmosql-1.25.2-py3-none-any.whl:
Publisher:
ci.yml on gizmodata/gizmosql-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gizmosql-1.25.2-py3-none-any.whl -
Subject digest:
916d39fbe65b5260c774f1adfc8150d89a336314e60c47f391f7989568d614a8 - Sigstore transparency entry: 1475061592
- Sigstore integration time:
-
Permalink:
gizmodata/gizmosql-py@e1016ba0070d7c8f9ec177c4f67c8865c966db6c -
Branch / Tag:
refs/tags/v1.25.2 - Owner: https://github.com/gizmodata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e1016ba0070d7c8f9ec177c4f67c8865c966db6c -
Trigger Event:
push
-
Statement type: