Skip to content

Commit

Permalink
Merge pull request #49 from QQDQ/main
Browse files Browse the repository at this point in the history
update sql sink、plugin list、error code and targz
  • Loading branch information
QQDQ authored Mar 14, 2024
2 parents 6a80a72 + 057881c commit b00e7f0
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 190 deletions.
4 changes: 2 additions & 2 deletions directory.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"children": [
{
"title": "使用 .tar.gz 包安装",
"path": "installation/tar.gz"
"path": "installation/targz"
},
{
"title": "使用 rpm 包安装",
Expand Down Expand Up @@ -902,7 +902,7 @@
"children": [
{
"title": "Installation with .tar.gz Package",
"path": "installation/tar.gz"
"path": "installation/targz"
},
{
"title": "Installation with rpm Package",
Expand Down
12 changes: 12 additions & 0 deletions en_US/api/error-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ This document describes the error codes that the data collection function will r
* 2105 Group parameters are invalid
* 2106 Group does not exist
* 2107 Group name is too long
* 2108 Group exceeds the maximum number under one node

* 2201 Tag does not exist
* 2202 Tag name conflict
Expand All @@ -68,6 +69,15 @@ This document describes the error codes that the data collection function will r
* 2306 System library is not allowed to be deleted
* 2307 Plugin is not allowed to be instantiated
* 2308 Plugin does not support this architecture
* 2309 Plugin in using
* 2310 Plugin add failed
* 2311 Plugin already exit
* 2312 Plugin not exist
* 2313 Plugin type no support
* 2314 Plugin version not match with core
* 2315 Plugin name error
* 2316 Plugin not match with c lib
* 2317 Plugin update failed

* 2400 License not found
* 2401 License is invalid
Expand All @@ -78,6 +88,7 @@ This document describes the error codes that the data collection function will r
* 2406 Hardware does not match the license
* 2407 License detects an abnormal clock
* 2408 License module is invalid
* 2409 License hardware token not found

* 2500 Template already exists
* 2501 Template does not exist
Expand All @@ -101,6 +112,7 @@ This document describes the error codes that the data collection function will r
* 3015 Plugin device is not responding
* 3016 Plugin does not support template
* 3017 Plugin does not support writing points
* 3018 Plugin does not support synchronous reading

## FILE error codes

Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion en_US/introduction/plugin-list/plugin-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For specific instructions on replacing and updating plugins, please contact the
| Modbus RTU | Serial port | - |
| Modbus RTU over TCP | Ethernet | - |
| OPC UA | Ethernet | - |
| OPC DA | Ethernet | - |
| CIP Ethernet/IP | Ethernet | - |
| Profinet IO | Ethernet | - |
| SECS GEM HSMS | Ethernet | Semiconductor Industry Protocol |
Expand Down Expand Up @@ -65,6 +66,8 @@ For specific instructions on replacing and updating plugins, please contact the
| Keyence MC Protocol | Ethernet | Mitsubishi MC Protocol |
| Delta Modbus TCP | Ethernet | connect to Delta DVP series、AS series PLC |
| KUKA Ethernet KRL TCP | Ethernet | connect to Kuka Device|
| GE SRTP | Ethernet | Access GE PLC devices that support SRTP protocol through TCP protocol. |



### electricity
Expand Down Expand Up @@ -98,7 +101,7 @@ For specific instructions on replacing and updating plugins, please contact the
| MQTT | - |
| MQTT Sparkplug B | - |
| Websocket | - |

| eKuiper | push data to data processing module |



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 32 additions & 85 deletions en_US/streaming-processing/sink/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,91 +10,38 @@ The sink will write the result to the database.

| Property name | Optional | Description |
|----------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url | false | The url of the target database |
| table | false | The table name of the result |
| fields | true | The fields to be inserted to. The result map and the database should both have these fields. If not specified, all fields in the result map will be inserted. |
| tableDataField | true | Write the nested values of the tableDataField into database. |
| rowkindField | true | Specify which field represents the action like insert or update. If not specified, all rows are default to insert. |
| Server Address | false | The url of the target database |
| Table Name | false | The table name of the database |
| Tag Fields | true | The fields to be inserted to. The result map and the database should both have these fields. If not specified, all fields in the result map will be inserted. |

Other common sink properties are supported. Please refer to the [sink common properties](../overview.md#common-properties) for more information.

## Sample usage

Below is a sample for using sql to get the target data and set to mysql database

```json
{
"id": "rule",
"sql": "SELECT stuno as id, stuName as name, format_time(entry_data,\"YYYY-MM-dd HH:mm:ss\") as registerTime FROM SqlServerStream",
"actions": [
{
"log": {
},
"sql": {
"url": "mysql://user:[email protected]/user?parseTime=true",
"table": "test",
"fields": ["id","name","registerTime"]
}
}
]
}
```

Write values of tableDataField into database:

The following configuration will write telemetry field's values into database

```json
{
"telemetry": [{
"temperature": 32.32,
"humidity": 80.8,
"ts": 1388082430
},{
"temperature": 34.32,
"humidity": 81.8,
"ts": 1388082440
}]
}
```

```json lines
{
"id": "rule",
"sql": "SELECT telemetry FROM dataStream",
"actions": [
{
"log": {
},
"sql": {
"url": "mysql://user:[email protected]/user?parseTime=true",
"table": "test",
"fields": ["temperature","humidity"],
"tableDataField": "telemetry",
}
}
]
}
```

### Update Sample

By specifying the `rowkindField` and `keyField`, the sink can generate insert, update or delete statement against the primary key.

```json
{
"id": "ruleUpdateAlert",
"sql":"SELECT * FROM alertStream",
"actions":[
{
"sql": {
"url": "sqlite://test.db",
"keyField": "id",
"rowkindField": "action",
"table": "alertTable",
"sendSingle": true
}
}
]
}
```
## Database Connection Address

Database connection address reference:

| database | url sample |
| ---------- | ----------------------------------------------------- |
| mysql | mysql://username:password@127.0.0.1:3306/testdb |
| sql server | sqlserver://username:password@127.0.0.1:1433/testdb |
| postgres | postgres://username:password@127.0.0.1:5432/testdb |
| oracle | oracle://username:password@127.0.0.1:1521/testdb |
| sqlite | sqlite:/tmp/test.db |

## Sample

The following is an example of writing device data collected by the data collection module into a MySQL database.

* Filter the points that need to be stored in MySQL in the SQL editor: `deviceid`, `devicename`, `temp`

<img src="../_assets/sql_sink_example1.png" alt="sql_sink_example1" style="zoom:100%;" />

* Add SQL Sink action
* Click the `Test Connection` button to test the database connection status
* Write `deviceid`, `devicename`, `temp` data into table `table1` of MySQL database `test`.

<img src="../_assets/sql_sink_example2.png" alt="sql_sink_example2" style="zoom:100%;" />

::: tip
Table `table1` needs to be created in advance in the MySQL database, and fields with the same column names `deviceid`, `devicename`, and `temp` exist, and the data types must be consistent.
:::
12 changes: 12 additions & 0 deletions zh_CN/api/error-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
* 2105 group 参数无效
* 2106 group 不存在
* 2107 group 名称太长
* 2108 group 超过同一 node 下最大数量

* 2201 tag 不存在
* 2202 tag 名称冲突
Expand All @@ -68,6 +69,15 @@
* 2306 系统库不允许删除
* 2307 插件不允许实例化
* 2308 插件不支持此架构
* 2309 插件使用中
* 2310 插件添加失败
* 2311 插件模块已存在
* 2312 插件模块不存在
* 2313 插件模块类型不支持
* 2314 插件模块版本和核心版本不匹配
* 2315 插件名称不符合规则
* 2316 插件依赖 C 库版本不匹配
* 2317 插件更新失败

* 2400 license 未找到
* 2401 license 无效
Expand All @@ -78,6 +88,7 @@
* 2406 license 硬件不匹配
* 2407 license 检测到时钟异常
* 2408 license 模块无效
* 2409 license 硬件标识未找到

* 2500 模板已存在
* 2501 模板不存在
Expand All @@ -101,6 +112,7 @@
* 3015 插件设备未响应
* 3016 插件不支持模板
* 3017 插件不支持写点位
* 3018 插件不支持同步读

## FILE 错误码

Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion zh_CN/introduction/plugin-list/plugin-list.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 数采插件列表

数采插件可以分为北向应用插件和南向驱动插件。北向插件通常用于连接到云平台或数据流处理模块。南向插件是实现特定协议以访问外部设备的通信驱动程序。为了实现协议格式转换,至少需要一个北向插件和一个南向插件分别用于数据传递和数据采集。
数采插件可以分为北向应用插件和南向驱动插件。北向插件通常用于连接到云平台或数据处理模块。南向插件是实现特定协议以访问外部设备的通信驱动程序。为了实现协议格式转换,至少需要一个北向插件和一个南向插件分别用于数据传递和数据采集。

登录 NeuronEX 后,您可点击**数据采集** -> **插件**查看系统的插件列表。您也可点击左上角的**添加插件**按钮安装自定义插件。

Expand Down Expand Up @@ -35,6 +35,7 @@
| Modbus RTU | 串口 | - |
| Modbus RTU over TCP | 以太网 | - |
| OPC UA | 以太网 | - |
| OPC DA | 以太网 | - |
| CIP Ethernet/IP | 以太网 | CIP –通用工业协议 |
| Profinet IO | 以太网 | - |
| SECS GEM HSMS | 以太网 | 半导体行业协议 |
Expand Down Expand Up @@ -66,6 +67,7 @@
| Keyence MC Protocol | 以太网 | 三菱 MC 协议 |
| Delta Modbus TCP | 以太网 | 对接台达DVP系列、AS系列PLC |
| KUKA Ethernet KRL TCP | 以太网 | 对接库卡设备 |
| GE SRTP | 以太网 | 通过 TCP 协议访问支持 SRTP 协议的 GE PLC 设备。 |


### 电力
Expand All @@ -91,6 +93,12 @@
| Fanuc Focas Ethernet | 以太网 | 连接Fanuc 0i, 30i, 31i, 32i and 35i系列CNC设备 |
| Mitsubishi CNC | 以太网 | | 连接M70、M80、M700、M800、E70等系列CNC设备 |

### 其他

| 协议名称 | <div style="width:60pt">接口类型</div> | 备注 |
| ------------- | ------- | ----- |
| 环保 HJ212-2017 协议 | 以太网/串口 | 采集支持环保 HJ212-2017 标准的设备数据 |

## 北向插件列表

### 云连接
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b00e7f0

Please sign in to comment.