A Python DB-API 2.0 driver for the Dameng (DM8) database — macOS ARM64 edition with a built-in Go bridge.
This is a community fork of the official dmPython driver. The upstream project relies on a proprietary C library (libdmdpi) that is not available for macOS. This fork replaces it with a Go-based DPI bridge (dpi_bridge/), enabling native macOS ARM64 support without requiring a full Dameng installation.
This fork is primarily recommended for local development validation, feature verification, and CI regression on macOS ARM64.
For production environments, prefer the official DamengDB/dmPython package (or vendor-supported distribution) to align with official support boundaries, compliance requirements, and SLA expectations.
- Supported build targets: macOS 14+ ARM64 with CPython 3.9–3.13. Database behavior is supported only where integration tests have evidence.
- Best-effort: Extended scenarios not currently covered by CI.
- Not guaranteed: Production SLA commitments, vendor-certified compatibility guarantees, and closed-source component support contracts.
The long-term improvement roadmap and phase status are maintained in docs/ROADMAP.md.
The open-source publishing Stage 0 records the distribution and test-environment gates before PyPI publishing.
CI and real-database regression describes the official DM8 ARM test job and macOS wheel checks.
Current phase snapshot:
- Phase 1 (Week 1-2): DONE
- Phase 2 (Week 3-4): DONE
- Phase 3 (Week 5-6): IN_PROGRESS
- Phase 4 (Week 7-8): NOT_STARTED
Download a pre-built wheel from GitHub Releases:
pip install dmPython_macOS-2.5.32-cp312-cp312-macosx_14_0_arm64.whlimport dmPython
conn = dmPython.connect(
user="SYSDBA",
password="SYSDBA001",
server="localhost",
port=5236,
)
cursor = conn.cursor()
cursor.execute("SELECT * FROM SYSOBJECTS WHERE ROWNUM <= 5")
for row in cursor.fetchall():
print(row)
cursor.close()
conn.close()- GitHub Pages: https://skhe.github.io/dmPython/
- Local preview:
pip install mkdocs
mkdocs servePrerequisites:
- Go 1.21+ (to compile the DPI bridge)
- Python 3.9 – 3.13
- DPI header files — place them in
./dpi_include/or setDM_HOME
# Clone the repository
git clone https://github.com/skhe/dmPython.git
cd dmPython
# Build the wheel
python -m build --wheel
# Or build the extension in-place for development
python setup.py build_ext --inplaceTo skip the Go build step (if you already have libdmdpi.dylib):
DMPYTHON_SKIP_GO_BUILD=1 python -m build --wheeldmPython/
├── setup.py # Build script
├── pyproject.toml # Project metadata
├── docs/ # Project docs (zh README, technical notes)
├── scripts/ # Local/ops scripts
├── src/native/ # C extension sources and headers
├── dpi_bridge/ # Go-based DPI bridge (replaces proprietary libdmdpi)
│ ├── main.go
│ ├── go.mod / go.sum
│ └── ...
├── dpi_include/ # DPI header files (not distributed, see README)
├── src/native/py_Dameng.c/h # Module entry, type registration, exception hierarchy
├── src/native/strct.h # Core struct definitions (Environment, Connection, Cursor)
├── src/native/Connection.c # Connection management
├── src/native/Cursor.c # Cursor operations, SQL execution
├── src/native/var.c # Variable management core
├── src/native/v*.c # Type-specific variable handlers
├── src/native/ex*.c # External object interfaces (LOB, BFILE, Object)
└── .github/workflows/ # CI: builds macOS ARM64 wheels for Python 3.9–3.13
The upstream dmPython source is licensed under Mulan PSL v2. The separately vendored Go driver's license remains to be verified; see Stage 0 before publishing artifacts.