QDataV2 adapter for kd-cosmic
Project description
qdata-adapter-kd-cosmic
QDataV2 金蝶云星瀚适配器
由 广东轻亿云软件科技有限公司 开发
「轻易云数据集成平台」官方适配器
📖 简介
qdata-adapter-kd-cosmic 是 QDataV2 数据集成平台的官方适配器,用于连接 金蝶云·星瀚(原金蝶云·苍穹)企业数字化平台。
平台说明
| 产品 | 说明 | 适配器 |
|---|---|---|
| 金蝶云·星瀚(原苍穹) | 面向大型企业的 SaaS/PaaS 平台 | qdata-adapter-kd-cosmic(本适配器) |
| 金蝶云·星空(K/3 Cloud) | 面向中小型企业的 ERP | qdata-adapter-kd-galaxy |
| 金蝶云·星辰 | 面向小微企业的 SaaS | 独立适配器 |
多版本支持
本适配器通过 api_version 参数支持金蝶星瀚多个版本:
| 版本 | 说明 | 支持状态 |
|---|---|---|
15.x |
星瀚标准版(默认) | ✅ 已支持 |
14.x |
苍穹 4.0 | 🔄 开发中 |
核心能力
- 版本自动路由: 根据
api_version自动选择对应版本的 API 实现 - Session 认证: 支持账套ID + 用户名 + 密码认证
- 完整 CRUD: 支持查询、创建、更新、删除操作
- 批量操作: 支持 BatchSave 等批量接口
- 异步迭代: 分页查询返回
AsyncIterator,内存友好
🚀 快速开始
安装
pip install qdata-adapter-kd-cosmic
基础用法
import asyncio
from qdata_adapter_kd_cosmic import KdCosmicAdapter
from qdata_adapter import ConnectorContext
async def main():
context = ConnectorContext(
connector_id="kd-cosmic-001",
app_software_code="kd_cosmic",
base_url="https://your-domain.kingdee.com/kdcosmic",
auth_config={
"acct_id": "账套ID",
"username": "用户名",
"password": "密码",
"lcid": 2052, # 语言代码:2052=简体中文
},
api_version="9.0", # 默认 9.0
)
adapter = KdCosmicAdapter(context)
# 测试连接
result = await adapter.test_connection()
print(f"连接状态: {result.status}")
# 分页查询物料
async for batch in adapter.execute_query(
form_id="BD_Material",
field_keys=["FMaterialId", "FNumber", "FName", "F Specification"],
filter_string="FDocumentStatus = 'C'",
page_size=500,
):
for item in batch:
print(item)
asyncio.run(main())
⚙️ 配置说明
auth_config 格式
{
"acct_id": "账套ID", # 必须,金蝶云星瀚账套唯一标识
"username": "用户名", # 必须,登录用户名
"password": "密码", # 必须,登录密码
"lcid": 2052, # 可选,语言代码,默认 2052(简体中文)
}
settings 配置
{
"api_version": "9.0", # 可选,默认 "9.0",支持 "7.x", "8.x", "9.x"
"locale": "zh_CN", # 可选,默认 "zh_CN"
}
ConnectorContext 参数
| 参数 | 说明 | 示例 |
|---|---|---|
api_version |
金蝶版本路由 | "9.0", "8.x", "7.x" |
📚 API 文档
KdCosmicAdapter
适配器主类,继承自 BaseAppAdapter。
核心方法
| 方法 | 说明 |
|---|---|
authenticate() |
执行 Session 登录认证 |
refresh_token() |
刷新 Token(金蝶不支持 refresh,重新登录) |
list_objects(type, filters, page, page_size) |
分页查询对象 |
get_object(type, id) |
获取单个对象 |
create_object(type, data) |
创建对象 |
update_object(type, id, data) |
更新对象 |
delete_object(type, id) |
删除对象 |
test_connection() |
连接测试 |
金蝶特有方法
| 方法 | 说明 |
|---|---|
execute_api(form_id, operation, data) |
执行任意金蝶 WebAPI |
execute_query(form_id, field_keys, filter_string, ...) |
分页查询,返回 AsyncIterator |
execute_batch(form_id, operation, data_list) |
批量操作 |
使用示例
# 视图查询(查看单个物料)
material = await adapter.execute_api(
form_id="BD_Material",
operation="View",
data={"Number": "M001"},
)
# 保存操作(创建/更新)
result = await adapter.execute_api(
form_id="BD_Material",
operation="Save",
data={
"FNumber": "M002",
"FName": "新物料",
"F Specification": "规格型号",
},
)
# 批量保存
results = await adapter.execute_batch(
form_id="BD_Material",
operation="BatchSave",
data_list=[
{"FNumber": "M003", "FName": "物料3"},
{"FNumber": "M004", "FName": "物料4"},
],
)
🧪 测试
# 安装开发依赖
make install-dev
# 运行测试(Mock 模式)
make test
# 运行测试(带覆盖率)
make test-cov
# 代码检查
make check
📄 许可与商业政策
本项目采用 MIT 开源协议。
🏢 关于轻易云数据集成平台
广东轻亿云软件科技有限公司 专注数据集成与处理,提供企业级 ETL/ELT 解决方案 🌐 官网:https://www.qeasy.cloud 📧 开源项目:opensource@qeasy.cloud 📧 商业咨询:vincent@qeasy.cloud
Powered by 广东轻亿云软件科技有限公司
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
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 qdata_adapter_kd_cosmic-0.1.3.tar.gz.
File metadata
- Download URL: qdata_adapter_kd_cosmic-0.1.3.tar.gz
- Upload date:
- Size: 208.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d57c01497b6e99e9ae2b289174b53761025c0df03293db1b63feae9e499faa
|
|
| MD5 |
295b1e366c3be01b655d16b0c55e0680
|
|
| BLAKE2b-256 |
b24034002c86d443474da0c20c4f2626dcb92095ac33dc81cb2e9c44a7537891
|
Provenance
The following attestation bundles were made for qdata_adapter_kd_cosmic-0.1.3.tar.gz:
Publisher:
publish.yml on vincent067/qdata-adapter-kd-cosmic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qdata_adapter_kd_cosmic-0.1.3.tar.gz -
Subject digest:
70d57c01497b6e99e9ae2b289174b53761025c0df03293db1b63feae9e499faa - Sigstore transparency entry: 1762682169
- Sigstore integration time:
-
Permalink:
vincent067/qdata-adapter-kd-cosmic@8a6a8afddcabe28210fdf87e0d2a9507da20e1f1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/vincent067
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8a6a8afddcabe28210fdf87e0d2a9507da20e1f1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file qdata_adapter_kd_cosmic-0.1.3-py3-none-any.whl.
File metadata
- Download URL: qdata_adapter_kd_cosmic-0.1.3-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be8b6391f0cc28387ad365484698a1ed9f801c036bb703a16f5ecd28dfd54376
|
|
| MD5 |
9f7a8424537520cb0514440144e7f939
|
|
| BLAKE2b-256 |
09a8082b77eeebb804a7161cb8a722b2c58d518d3388d4290357f099c87443ea
|
Provenance
The following attestation bundles were made for qdata_adapter_kd_cosmic-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on vincent067/qdata-adapter-kd-cosmic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qdata_adapter_kd_cosmic-0.1.3-py3-none-any.whl -
Subject digest:
be8b6391f0cc28387ad365484698a1ed9f801c036bb703a16f5ecd28dfd54376 - Sigstore transparency entry: 1762682318
- Sigstore integration time:
-
Permalink:
vincent067/qdata-adapter-kd-cosmic@8a6a8afddcabe28210fdf87e0d2a9507da20e1f1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/vincent067
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8a6a8afddcabe28210fdf87e0d2a9507da20e1f1 -
Trigger Event:
release
-
Statement type: