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.
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
Licensed under Mulan PSL v2.