|
@@ -13,19 +13,20 @@ Since the operation of the tdengine plug-in depends on the tdengine client, for
|
|
|
|
|
|
As the tdengine database requires a timestamp field in the table, the user must inform the timestamp field name of the data table (required tsFieldName). The user can choose whether to provide timestamp data. If not (provideTs=false), the content of the timestamp field is automatically generated by the tdengine database.
|
|
As the tdengine database requires a timestamp field in the table, the user must inform the timestamp field name of the data table (required tsFieldName). The user can choose whether to provide timestamp data. If not (provideTs=false), the content of the timestamp field is automatically generated by the tdengine database.
|
|
|
|
|
|
-| Name | Type | Optional | Description |
|
|
|
|
-|-------------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
-| host | string | true | Database host, it must be a host name aka. [FQDN](https://www.taosdata.com/blog/2020/09/11/1824.html). An IP address is invalid. The default value is localhost. |
|
|
|
|
-| port | int | false | Database port |
|
|
|
|
-| user | string | true | Username, default to `root`. |
|
|
|
|
-| password | string | true | Password, default to `taosdata`. |
|
|
|
|
-| database | string | false | Database name. |
|
|
|
|
-| table | string | false | Table Name, could be a [dynamic property](../../overview.md#dynamic-properties). |
|
|
|
|
-| fields | []string | 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. |
|
|
|
|
-| provideTs | Bool | true | Whether the user provides a timestamp field, default to false. |
|
|
|
|
-| tsFieldName | String | true | Timestamp field name |
|
|
|
|
-| sTable | String | true | The super table to be use, could be a [dynamic property](../../overview.md#dynamic-properties). |
|
|
|
|
-| tagFields | []String | true | The result fields to be used as the tag values in order. If sTable is specified, this is required. |
|
|
|
|
|
|
+| Name | Type | Optional | Description |
|
|
|
|
+|----------------|----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
+| host | string | true | Database host, it must be a host name aka. [FQDN](https://www.taosdata.com/blog/2020/09/11/1824.html). An IP address is invalid. The default value is localhost. |
|
|
|
|
+| port | int | false | Database port |
|
|
|
|
+| user | string | true | Username, default to `root`. |
|
|
|
|
+| password | string | true | Password, default to `taosdata`. |
|
|
|
|
+| database | string | false | Database name. |
|
|
|
|
+| table | string | false | Table Name, could be a [dynamic property](../../overview.md#dynamic-properties). |
|
|
|
|
+| fields | []string | 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. |
|
|
|
|
+| provideTs | Bool | true | Whether the user provides a timestamp field, default to false. |
|
|
|
|
+| tsFieldName | String | true | Timestamp field name |
|
|
|
|
+| tagFields | []String | true | The result fields to be used as the tag values in order. If sTable is specified, this is required. |
|
|
|
|
+| sTable | String | true | The super table to be use, could be a [dynamic property](../../overview.md#dynamic-properties). |
|
|
|
|
+| tableDataField | String | true | Write the nested values of the tableDataField into database. |
|
|
|
|
|
|
## Operation example
|
|
## Operation example
|
|
|
|
|
|
@@ -80,3 +81,41 @@ Write into dynamic table:
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+
|
|
|
|
+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,
|
|
|
|
+ "f3": "f3tagValue",
|
|
|
|
+ "f4": "f4tagValue",
|
|
|
|
+ "ts": 1388082430
|
|
|
|
+ },{
|
|
|
|
+ "temperature": 34.32,
|
|
|
|
+ "humidity": 81.8,
|
|
|
|
+ "f3": "f3tagValue",
|
|
|
|
+ "f4": "f4tagValue",
|
|
|
|
+ "ts": 1388082440
|
|
|
|
+ }]
|
|
|
|
+}
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+```json lines
|
|
|
|
+{
|
|
|
|
+ "tdengine": {
|
|
|
|
+ "host": "hostname",
|
|
|
|
+ "port": 6030,
|
|
|
|
+ "database": "dab",
|
|
|
|
+ "table": "tableName", // dynamic value, get from the table field of the result
|
|
|
|
+ "tsfieldname": "ts",
|
|
|
|
+ "fields": []string{"temperature", "humidity"}, // Write f1, f2 fields in result into f1, f2 columns in the db
|
|
|
|
+ "sTable": "myStable", // super table name, also allow dynamic
|
|
|
|
+ "tableDataField": "telemetry", // write values of telemetry field into database
|
|
|
|
+ "tagFields": []string{"f3","f4"} // Write f3, f4 fields' values in the result as tags in order
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+```
|