Modern Python web services are async to the core: FastAPI endpoints, Quart apps, aiohttp workers, all built on one event loop that never blocks. And then they need a number out of IBM Netezza, and the whole design springs a leak. The existing Python drivers are synchronous DB-API implementations, so every query has to be pushed onto a thread pool with run_in_executor – one parked thread per in-flight query, a hard ceiling on concurrency, and a scheduling tax on every await. PostgreSQL solved this years ago when asyncpg reimplemented the wire protocol natively on asyncio. Netezza never got its asyncpg. Now it has one.

aionetezza implements the NPS wire protocol directly on asyncio streams. A query awaits on the socket, not on a thread; a thousand concurrent requests need a thousand cheap coroutines, not a thousand threads. And in keeping with the rest of our driver programme, it has zero dependencies – asyncio, hashlib and ssl all ship with Python – so it installs on the locked-down hosts where enterprise Python actually runs.

The asyncpg model, deliberately

The API will feel immediately familiar to anyone who has used asyncpg: connect, query, query_params, execute, all awaitable, one in-flight statement per connection, open several connections and gather them for parallelism. Our live test suite makes the point by running its entire matrix against a classic NPS 7.2 rack and a current NPS 11.2 system concurrently, on one event loop, including four simultaneous TLS sessions. Zero threads were involved.

Underneath sits the same protocol engine we have now hardened across ten languages: both result formats the appliance uses (including the binary engine-tuple format real table scans arrive in), the full type system with 38-digit numerics decoded exactly through Python’s arbitrary-precision integers, correct handling of the European encoding Netezza uses for CHAR and VARCHAR, injection-safe parameter binding verified against hostile input, and external tables in both directions for bulk work.

TLS on an event loop, without the folklore

Encrypting a Netezza session from asyncio has a wrinkle: the TLS handshake happens mid-connection, after the protocol negotiates it, and Python only grew a public API for stream-level mid-connection TLS in 3.11. aionetezza supports Python 3.9, so it performs the upgrade at the transport layer directly – the documented recipe, wrapped in the driver so you never see it. One keyword argument and the session is encrypted, against current appliances and against older NPS 7 racks whose self-signed certificates modern OpenSSL settings would otherwise reject.

Honest edges

Results are fully fetched per statement rather than cursor-streamed; for the request/response workloads async services run, that is almost always what you want, and external tables cover the genuinely huge transfers. File writes during an external-table unload are ordinary disk writes between socket reads, the same pragmatic trade asyncpg makes for COPY. PyPI publication is coming soon. Until then it is a single pure-Python package.

An async service should await its warehouse, not thread-pool around it.

Where you get it

We built this for the Netezza community rather than as a product of our own. If your FastAPI service talks to Netezza through a thread pool, you can delete the thread pool. Talk to us if you want it in your own estate.

Built from the published open source Netezza drivers (IBM/nzpy and IBM/nzalchemy under Apache-2.0, IBM/nzgo under MIT), verified live against both NPS 7.2 and NPS 11.2, and produced without decompiling, disassembling or inspecting any IBM proprietary binary.

Running Netezza? Let’s talk. Smart Associates has been engineering on IBM Netezza for two decades: disaster recovery, migrations, performance and the deep platform work in between. If any of the above sounds familiar, why not get in touch.

Adam Matusewicz
Adam Matusewicz
I am an experienced technical IT specialist, and an expert in the support of IBM Netezza/PureData systems]– Massive Parallel Processing (MPP) Database with inbuilt analytical functions – powered by a combination of highly modified Postgres and FPGA or CUDA (by NVIDIA). I am the principal Smart Management Frameworks developer, which is a utility to maintain Netezza appliances. I have worked for Smart Associates for the past 8 years, and prior to that worked 7 years with Netezza as a Platform Support Engineer (IBM and Netezza)