Skip to main content

3DS平台业务层的数据查询SDK

Project description

D3SDK

D3SDK是3DS系统提供的数据开发包(以下简称SDK),用于简化Python里访问各类数据库的操作。

一、安装

1.1 安装SDK

安装SDK最新版本:

pip install -U d3sdk

二、使用SDK

2.1 查询报警组列表

调用SDK代码示例:

from d3sdk.d3_dataframe_db import D3DataFrameDB
from d3sdk.model.device_failure_record import DeviceFailureRecord

k2a_host = '192.168.132.167'
k2a_port = 443
k2a_user = 'zhangsan'
k2a_basic_token = '0c475ffd8960c17046b531e2xxx'

k2a_url = f'k2assets+3ds://{k2a_user}:{k2a_basic_token}@{k2a_host}:{k2a_port}'
db = D3DataFrameDB(k2a_url)
result = db.getDeviceFailureRecords(
                             start_time_1='2024-06-30 12:56:47',
                             end_time_1='2024-06-30 12:56:50',
                             start_time_2='2024-06-30 13:42:47',
                             end_time_2='2024-06-30 13:59:59',
                             devices=['T0000000002'],
                             desc=True)
print(type(result[0]))
print(result[0].dfem_code)
print(result[0].fms)

运行结果示例:

<class 'd3sdk.device_failure_record.DeviceFailureRecord'>
AG0000101009
[Fm(fm_code=QLJ00001, fm_name=定子), Fm(fm_code=QLJ00008, fm_name=定子绕组温度)]

2.2根据报警组编号查询关联的业务对象实例

调用SDK代码示例:

from d3sdk.d3_dataframe_db import D3DataFrameDB
from d3sdk.model.alarm_group_detail import AlarmGroupDetail

k2a_host = '192.168.132.167'
k2a_port = 443
k2a_user = 'zhangsan'
k2a_basic_token = '0c475ffd8960c17046b531e2xxx'

k2a_url = f'k2assets+3ds://{k2a_user}:{k2a_basic_token}@{k2a_host}:{k2a_port}'
db = D3DataFrameDB(k2a_url)
result = db.getFailureCodes(dfem_code='AG0000121409')
print(result)
print(type(result[0]))
print(result[0].dfem_sxmsbh)
print(result[0].causes)

运行结果示例:

<class 'd3sdk.model.alarm_group_detail.AlarmGroupDetail'>
FM800412
[Cause(code='RS...001', display_name='定子绕组...超限原因',
        description='定子冷却水...堵塞或结垢。', 
        steps=[Step(code='JY...001', display_name='定子绕组...超限处理建议', 
                    description='检查定子...负载是否平衡。'), 
                Step(code='JY...004', display_name='定子绕组...报警处理建议', 
                    description='检查冷却水...等是否正常')])]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

d3sdk-0.1.11-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file d3sdk-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: d3sdk-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for d3sdk-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 0d0cba0795a09d65e00923cf324119ad17749e36c5bc8c5113f7ce120418fd93
MD5 a0f512174c9c42c81ae1461695cde1e4
BLAKE2b-256 6683440ffe8adfb9e1beef0e400b9554b96e8820db803ac0c44824a7ff17e42b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page