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.9-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d3sdk-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for d3sdk-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 23ecbb1f96a5729d218ddb58b08624e21671be396725ee3abb8c149f229ad71d
MD5 48917bb640a33164bf5b8b7b1bd880a5
BLAKE2b-256 064679ffe47686dadba45800ab2ccc4d70509d27d1ae6ec5a84a19483be466a4

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