Skip to content

jdbc4py

Python access to databases whose native drivers are weak, commercial, or missing — and a fast Arrow bulk-read path across any database with a JDBC driver. A DBAPI 2.0 interface, a connection pool, cross-database queries, and a SQLAlchemy dialect so it drops into pandas and ORMs.

pip install "jdbc4py[dataframe]"   # Arrow bulk reads into pandas / Polars / DuckDB

Requires a Java 11+ runtime (a JRE is enough). See Installation.

from jdbc4py import connect

with connect(engine="postgres", host="localhost", database="mydb",
             user="me", password="secret") as conn:
    df = conn.read_sql("SELECT * FROM events", format="pandas")

Highlights

  • DBAPI 2.0 + a SQLAlchemy dialect (postgresql+jdbc4py://…) for pandas/ORMs
  • Arrow bulk reads — serialized on the JVM side; fast pandas/Polars loads
  • asyncio support via jdbc4py.aio
  • Server-side streaming (stream=True) for very large results
  • Connection pooling, write paths, query cancellation, rich type mapping (incl. vectors and full Unicode)

Where to go next

Runnable examples for every feature live in the examples/ directory.