Skip to main content

IBM Netezza python driver - extended fork

Project description

nzpy_extended: High-performance IBM Netezza driver for Python

nzpy_extended is a hard fork of IBM nzpy — enriched with new features, major performance improvements via a C extension, and expanded platform support.

Key differences from upstream nzpy

Feature nzpy (IBM) nzpy_extended
Row parsing performance (mixed types) ~4 800 rows/s ~37 000 rows/s (no C ext) → ~51 000 rows/s (+ C ext, on par with ODBC ~50 k)
Supported Python 3.5+ 3.12, 3.13, 3.14
Platform wheels ❌ None ✅ Linux x64, macOS ARM, Windows x64 (pre-built)
Async support ✅ Fully async API

Performance gains vary by data type. For mixed-type workloads (most representative of real-world queries), nzpy_extended reaches ~51 000 rows/s with C extension (vs. ~4 800 rows/s for official nzpy — a ~10.7× improvement) and ~37 000 rows/s without C extension (~7.7× improvement). Per-type benchmarks with 100 k rows:

Data type official nzpy nzpy_extended (no C ext) nzpy_extended (+ C ext) vs. ODBC
INTEGER ~16 k rows/s ~200 k rows/s ~281 k rows/s ≈ ODBC (~283 k)
NUMERIC ~8 k rows/s ~73 k rows/s ~109 k rows/s ≈ ODBC (~106 k)
STRING ~18 k rows/s ~94 k rows/s ~96 k rows/s ≈ ODBC (~96 k)
DATETIME ~17 k rows/s ~122 k rows/s ~274 k rows/s ≈ ODBC (~273 k)
BOOLEAN ~22 k rows/s ~235 k rows/s ~433 k rows/s ≈ ODBC (~435 k)
Mixed ~4 800 rows/s ~37 k rows/s ~51 k rows/s ≈ ODBC (~50 k)

The C extension accelerates integer, decimal, datetime, and boolean parsing by avoiding Python object allocations per field and struct.unpack overhead. String parsing is primarily network-bound, so the C extension offers minimal benefit there.

If the compiled extension is not available (unsupported platform or Python version), the driver gracefully falls back to pure Python with identical semantics.

Installation

pip install nzpy_extended

Pre-built wheels are provided for:

Platform Architecture Python
Linux x86_64 (manylinux) 3.12 / 3.13 / 3.14
macOS ARM64 (Apple Silicon) 3.12 / 3.13 / 3.14
Windows x86_64 3.12 / 3.13 / 3.14

For other platforms or Python versions, pip install will compile the C extension from source (requires a C compiler: GCC, Clang, or MSVC). On systems without a compiler the install will fail — use a supported platform or version.

Quick Start

Sync — scripts, ETL, Jupyter, Django

import nzpy_extended.sync as nzpy

conn = nzpy.connect(
    user="admin", password="secret",
    host="netezza-host", database="mydb",
)
with conn.cursor() as cur:
    cur.execute("SELECT id, name FROM users WHERE active = ?", (1,))
    for row in cur:
        print(row)

Async — FastAPI, asyncio

import asyncio
import nzpy_extended as nzpy

async def main():
    async with await nzpy.connect(
        user="admin", password="secret",
        host="netezza-host", database="mydb",
    ) as conn:
        async with conn.cursor() as cur:
            await cur.execute("SELECT id, name FROM users WHERE active = ?", (1,))
            return await cur.fetchall()

asyncio.run(main())

FastAPI with connection pool

from fastapi import FastAPI, Depends
import nzpy_extended as nzpy
import nzpy_extended.fastapi as nzpy_fastapi

pool = nzpy.NzPool(
    min_size=2, max_size=10,
    host="netezza-host", database="mydb",
    user="admin", password="secret",
)

app = FastAPI(lifespan=nzpy_fastapi.lifespan(pool))

@app.get("/users")
async def get_users(conn=Depends(nzpy_fastapi.get_connection)):
    async with conn.cursor() as cur:
        await cur.execute("SELECT * FROM users LIMIT 100")
        return await cur.fetchall()

Requirements

  • Python ≥ 3.12
  • CPython (PyPy not supported for C extension, pure-Python fallback only)

Documentation

Testing

Running the test suite

Tests require a running Netezza instance. Set the connection environment variables:

export NZ_DEV_HOST=your_netezza_host
export NZ_DEV_PORT=5480
export NZ_DEV_DB=JUST_DATA
export NZ_DEV_USER=admin
export NZ_DEV_PASSWORD=password

Run all tests:

pytest tests/ -v

C Extension / Pure Python parity

The C extension and pure-Python fallback must produce identical results for all data types. Parity tests verify this in two ways:

Unit tests (tests/test_c_python_parity_unit.py) — compare individual C parser functions against Python reference implementations byte-by-byte. No database required.

pytest tests/test_c_python_parity_unit.py -v

Integration tests (tests/test_c_python_parity_integration.py) — run real SQL queries through both code paths and verify results match. Requires a database.

pytest tests/test_c_python_parity_integration.py -v

Verification script — runs both test suites in C-extension and pure-Python modes side-by-side:

python tools/verify_c_python_parity.py

Disabling C extension at runtime:

Set the environment variable NZPY_EXTENDED_NO_CEXT=1 to force pure-Python mode even when the compiled extension is available. Useful for debugging or verifying fallback correctness.

NZPY_EXTENDED_NO_CEXT=1 pip install nzpy_extended
# or at runtime:
NZPY_EXTENDED_NO_CEXT=1 python -c "import nzpy_extended.core; print(nzpy_extended.core._HAVE_C_EXT)"  # False

License

Apache License 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nzpy_extended-0.0.2.tar.gz (112.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nzpy_extended-0.0.2-cp314-cp314-win_amd64.whl (80.5 kB view details)

Uploaded CPython 3.14Windows x86-64

nzpy_extended-0.0.2-cp314-cp314-manylinux1_x86_64.manylinux_2_5_x86_64.whl (112.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.5+ x86-64

nzpy_extended-0.0.2-cp314-cp314-macosx_10_15_universal2.whl (87.2 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

nzpy_extended-0.0.2-cp313-cp313-win_amd64.whl (80.2 kB view details)

Uploaded CPython 3.13Windows x86-64

nzpy_extended-0.0.2-cp313-cp313-manylinux1_x86_64.manylinux_2_5_x86_64.whl (112.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.5+ x86-64

nzpy_extended-0.0.2-cp313-cp313-macosx_10_13_universal2.whl (86.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

nzpy_extended-0.0.2-cp312-cp312-win_amd64.whl (80.2 kB view details)

Uploaded CPython 3.12Windows x86-64

nzpy_extended-0.0.2-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl (112.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.5+ x86-64

nzpy_extended-0.0.2-cp312-cp312-macosx_10_13_universal2.whl (86.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

File details

Details for the file nzpy_extended-0.0.2.tar.gz.

File metadata

  • Download URL: nzpy_extended-0.0.2.tar.gz
  • Upload date:
  • Size: 112.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nzpy_extended-0.0.2.tar.gz
Algorithm Hash digest
SHA256 647517a706f1b4bfd84b494ef4c44a7e8b69feea2939ac12988164ee7503918a
MD5 2ea5c124446c7e3ebe5c641b5fe1d6e6
BLAKE2b-256 f853f6a811bf1d36ea84ed987e7e5cf641559128e89cc787fa0c616ef1e69f08

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2.tar.gz:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6db83acf021832518ee385b3ed826a13a48d4a16d886d59f0691c90ef4d8d970
MD5 c1f04faacfeaa936b0842ea62d5cf799
BLAKE2b-256 cc39332bb3edaf0805cb43d94e9d20462fd54ded3d7baa1d0d4e3046100017d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp314-cp314-win_amd64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp314-cp314-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp314-cp314-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 de2c5e96c30ab5d6640f34494b52a9223e3754f5be87c3671eb692b900a6f1f4
MD5 6cf5bc088dc2ac10d3d7f3d5282701bd
BLAKE2b-256 52d0594802687495d05b77413a349953c37b2f911a7e5d0b32330b0d6cddaa8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp314-cp314-manylinux1_x86_64.manylinux_2_5_x86_64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7e2be6726af9b2c9b42a7d71880897901176552100993541ca0788b1a79011b0
MD5 3e40c061da13f5ccee1a925e28ec5f8a
BLAKE2b-256 ab42239bede752d0ddaf8b0bc205f3aed6816334e54947a45470e0927800babd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp314-cp314-macosx_10_15_universal2.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3a59ac43b9f19c5ddc61d05e03845792790ed0d6770ffca5507f8705471c463c
MD5 72ef671c5d96ccdbedc11a928c5e57e1
BLAKE2b-256 a7d64a9296783e5243a13d69bcf5ab834185b400e95fa054b1c1ed287c4eb9bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp313-cp313-win_amd64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp313-cp313-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp313-cp313-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 16dd14f174c8fefd46cd27037873a72017cfa2504f4e73806c75cc2f1b26d90e
MD5 99844f33080354bf9dbf6632273aeff3
BLAKE2b-256 3ef35f020093f7c6f349ce9393834a66cf3969a17206f1442e5deb66807e67d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp313-cp313-manylinux1_x86_64.manylinux_2_5_x86_64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 eab220a4af238656d3934717e546a6c720aeb59c8900a32a52ccf035557d29e1
MD5 3018c0c3f03faa58cab1b7ce08593921
BLAKE2b-256 fca61836a960e490387646368cdf26bc2aaf454896bb7595a0cae41d01538cd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp313-cp313-macosx_10_13_universal2.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 031329b6e0b88807ba151c8121daaa6cca5992d0c6d934a2553bedd0a6cf62a6
MD5 cf50552e53c76e47e3574fb47bc509a8
BLAKE2b-256 24437ccf332ac57854087c772bda2612fc64ae5dd2322c0089f6252403439bd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp312-cp312-win_amd64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 90a8acb93c43ccaf84e49e84f7fdfb72770902eda083e3b474df5f5c3cd5454f
MD5 a7cc561b5217e7d4b4c5969428b77547
BLAKE2b-256 7b5d438dfa59d084712eaccd3c66df8a5799218d2d3bd22afd437d633da365d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp312-cp312-manylinux1_x86_64.manylinux_2_5_x86_64.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nzpy_extended-0.0.2-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for nzpy_extended-0.0.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 d3ce7338bb28eaf72a8272258b1da33dc0f94f4601528da27474c0300b57f481
MD5 8d33b5d4afc6dcccd57b6a0d0fea302f
BLAKE2b-256 be71681aa2302e41efaea0402def07c0a02bf534109ab9dabd0a108bcf89f65b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nzpy_extended-0.0.2-cp312-cp312-macosx_10_13_universal2.whl:

Publisher: publish.yaml on KrzysztofDusko/nzpy_extended

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page