dmPython-pure
纯 Python 实现的 dmPython 兼容层:底层转发给 dm-pure(纯 Python 达梦 DM8 驱动)。
让依赖官方 dmPython 的库(如 dmSQLAlchemy,方言 dm+dmPython://)零修改可用——
官方 dmPython 是 C 扩展(.pyd),在较新 Python 上编译困难;本包纯 Python,Python 3.8+ 直接可装。
安装
# 方式一:GitHub Releases / PyPI(pyc 字节码版,按 Python 版本选)
pip install dmPython-pure==1.0.0
# 方式二:源码构建(本仓库 shim/ 目录)
cd shim && pip install .
pyc 版 wheel 绑定 Python 版本(
cp310只能 Python 3.10 用),请选择与本地 Python 一致的版本。
使用(dmSQLAlchemy)
from sqlalchemy import create_engine
from sqlalchemy.orm import declarative_base, Session
engine = create_engine("dm+dmPython://SYSDBA:password@127.0.0.1:5236/")
与官方 dmPython 完全相同的用法,无需任何改动。
直接使用(DB-API 2.0)
import dmPython
conn = dmPython.connect(host="127.0.0.1", port=5236, user="SYSDBA", password="...")
cur = conn.cursor()
cur.execute("SELECT id, name FROM t WHERE id = ?", [1])
print(cur.fetchall())
conn.close()
实现说明
paramstyle = "qmark"(与官方 dmPython 一致;SQLAlchemy 方言的 paramstyle 取自 dbapi.paramstyle)INSERT后lastrowid通过SELECT @@IDENTITY获取- 补齐官方 Connection 特有属性:
str_case_sensitive/local_code/server_version/current_schema/autoCommit - 包内含 vendored
dmpy(dm-pure 驱动),单 wheel 自包含、零外部依赖
已知限制
nextset恒返回 None(不支持多结果集)cursor.var(OUT/RETURNING 变量)为占位实现,INSERT..RETURNING 尚未完整支持- 未实现异步(async)方言
发布
参考 .github/workflows/shim-release.yml:打 shim-v* tag 或手动触发,
自动为各 Python 版本构建 pyc 版 wheel 并上传 GitHub Releases / PyPI。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dmpython_pure-1.0.0-cp313-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp313-none-any.whl
- Upload date:
- Size: 84.0 kB
- Tags: CPython 3.13
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f90673ea5bf8c5db1d8217f449f89602d1a4314e65e3ff465bffc340f92384
|
|
| MD5 |
be34714da3cdf3931a2b9b6645721f73
|
|
| BLAKE2b-256 |
eb571d22bf497f06bcb927ee459e2fb25c9494af251401513e11bb4aba719dfc
|
File details
Details for the file dmpython_pure-1.0.0-cp312-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp312-none-any.whl
- Upload date:
- Size: 83.1 kB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2745e178e97462ec4451952959d82b4d523922458927be0ccb706cdfe3f7ca6d
|
|
| MD5 |
b087c5b5e2aeb7bc46080c4d6fee2821
|
|
| BLAKE2b-256 |
11d0e33b56240deed5a2d1ece92ac7322221fd7b2275f3830fe82bd521d2740b
|
File details
Details for the file dmpython_pure-1.0.0-cp311-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp311-none-any.whl
- Upload date:
- Size: 87.0 kB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7022cb65d3ba29db952a7b2d76439e310b4a79188aca41ac52dd3c9cedc66c9d
|
|
| MD5 |
ad71c3512c182aed67f371eb89eee1c8
|
|
| BLAKE2b-256 |
b923ea7a5a219a3d828f5125b30f28ab48911747451a1ac5386b8e33e1b3bfab
|
File details
Details for the file dmpython_pure-1.0.0-cp310-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp310-none-any.whl
- Upload date:
- Size: 57.3 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
582d2c7324186b68f08da7c41e658e2d38e7f73dec487b1de8c5d87080fbdab1
|
|
| MD5 |
4a63ce7eedd10b3609777c0aef40d780
|
|
| BLAKE2b-256 |
5bc8ffe282246afc95dcaca08fc3ff8137899e2e144767520527d42e920d05ad
|
File details
Details for the file dmpython_pure-1.0.0-cp39-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp39-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af63c82edadbd304a48b19e70b677ffcf3007b94803ec1c46fac02ae780ca700
|
|
| MD5 |
4ed53e3a912e55d9e5408ed0b50748db
|
|
| BLAKE2b-256 |
970da906249c1d9fba3aa8bd07102250da7b7cf7e0ed29fd64f44b82dd538ce4
|
File details
Details for the file dmpython_pure-1.0.0-cp38-none-any.whl.
File metadata
- Download URL: dmpython_pure-1.0.0-cp38-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbac4d4d4ab586b7960785bb63377773d98528a587afe87cd0f8d534044dc81a
|
|
| MD5 |
41cca1746b93dc971f727d2000964bea
|
|
| BLAKE2b-256 |
f0b6750b3f2d1b79c464060340c03f60e4a2201cff3ba998c9a4cc79fe97c16d
|