duckdbalchemy
Active fork of duckdb_engine (which is unmaintained). SQLAlchemy dialect for DuckDB.
为什么 fork
duckdb_engine 的反射层继承自 PostgreSQL 方言,主键反射查 pg_catalog,对 DuckDB 一律返回空——导致 SQLAlchemy 的 automap 无法生成 ORM 类。上游已停更,故 fork 自维护。
主要改进
- 主键反射:覆盖
get_pk_constraint/get_multi_pk_constraint,查 DuckDBinformation_schema,automap_base.prepare()现在能正常生成 mapped class。 - 接管
duckdb://scheme(通过 entry_points),对使用create_engine("duckdb:///...")的代码(如 kepler.wind)零改动。 - 后续:补全外键、唯一约束、索引反射;类型映射优化。
安装
pip uninstall duckdb-engine # 释放 duckdb:// scheme
pip install -e .
用法
from sqlalchemy import create_engine
e = create_engine("duckdb:///path/to/db.duckdb") # 自动用本包的 Dialect
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
duckdbalchemy-0.1.0.tar.gz
(13.3 kB
view details)
Built Distribution
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 duckdbalchemy-0.1.0.tar.gz.
File metadata
- Download URL: duckdbalchemy-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2579760484c4ff0a22c0b4540d8e5993de28e5c9316c8fe29d77c26bd9abf95
|
|
| MD5 |
917e63a3e825cadd858fefca55900939
|
|
| BLAKE2b-256 |
aa0d16d35a5eb20a9afa23e9650fa86cacca651d224803e4ce5ebfaa413f32c5
|
File details
Details for the file duckdbalchemy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: duckdbalchemy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86a579610bc3943aeba73417bf80049801f810e78f132ea43c682167c7c45a85
|
|
| MD5 |
3b2eab21ac2289cbf2b4e88d3c5798c7
|
|
| BLAKE2b-256 |
f14f4cc322c111433ee43d29c31cda269c052b2b6746d6d051c4618d12838374
|