Skip to content

Commit 6aeb6f5

Browse files
authored
Merge pull request #2689 from emqx/add-undefined-vars-as-null
update(integration): Add "Undefined Vars as Null" config
2 parents 17eba42 + 2cc66e5 commit 6aeb6f5

10 files changed

+120
-0
lines changed

en_US/data-integration/data-bridge-clickhouse.md

+12
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ This section demonstrates how to create a rule in Dashboard for processing messa
139139
140140
Here, `${data}` and `${timestamp}` represent the message content and timestamp, respectively, which will be configured later in the rules for message forwarding. EMQX will replace them with the corresponding content before forwarding the message.
141141
142+
If a placeholder variable is undefined in the SQL template, you can toggle the **Undefined Vars as Null** switch above the **SQL template** to define the rule engine behavior:
143+
144+
- **Disabled** (default): The rule engine can insert the string `undefined` into the database.
145+
146+
- **Enabled**: Allow the rule engine to insert `NULL` into the database when a variable is undefined.
147+
148+
::: tip
149+
150+
If possible, this option should always be enabled; disabling the option is only used to ensure backward compatibility.
151+
152+
:::
153+
142154
11. Advanced settings (optional): See [Advanced Configurations](#advanced-configurations).
143155
144156
12. Before clicking **Create**, you can click the **Test Connectivity** button to ensure that you can connect to the ClickHouse server.

en_US/data-integration/data-bridge-dynamo.md

+12
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ This section demonstrates how to create a rule in the Dashboard for processing m
152152

153153
:::
154154

155+
If a placeholder variable is undefined in the SQL template, you can toggle the **Undefined Vars as Null** switch above the **SQL template** to define the rule engine behavior:
156+
157+
- **Disabled** (default): The rule engine can insert the string `undefined` into the database.
158+
159+
- **Enabled**: Allow the rule engine to insert `NULL` into the database when a variable is undefined.
160+
161+
::: tip
162+
163+
If possible, this option should always be enabled; disabling the option is only used to ensure backward compatibility.
164+
165+
:::
166+
155167
4. Click the + **Add Action** button to define an action that will be triggered by the rule. With this action, EMQX sends the data processed by the rule to DynamoDB.
156168

157169
5. Select `DynamoDB` from the **Type of Action** dropdown list. Keep the **Action** dropdown with the default `Create Action` value. You can also select a Sink if you have created one. This demonstration will create a new Sink.

en_US/data-integration/data-bridge-mysql.md

+12
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ This demonstration assumes that you run both EMQX and MySQL on the local machine
164164
)
165165
```
166166

167+
If a placeholder variable is undefined in the SQL template, you can toggle the **Undefined Vars as Null** switch above the **SQL template** to define the rule engine behavior:
168+
169+
- **Disabled** (default): The rule engine can insert the string `undefined` into the database.
170+
171+
- **Enabled**: Allow the rule engine to insert `NULL` into the database when a variable is undefined.
172+
173+
::: tip
174+
175+
If possible, this option should always be enabled; disabling the option is only used to ensure backward compatibility.
176+
177+
:::
178+
167179
9. Advanced settings (optional): See [Advanced Configurations](#advanced-configurations).
168180

169181
10. Click the **Create** button to complete the Sink configuration. A new Sink will be added to the **Action Outputs.**

en_US/data-integration/data-bridge-sqlserver.md

+12
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,18 @@ This section demonstrates how to create a rule in the Dashboard for processing m
271271
insert into t_mqtt_msg(msgid, topic, qos, payload) values ( ${id}, ${topic}, ${qos}, ${payload} )
272272
```
273273

274+
If a placeholder variable is undefined in the SQL template, you can toggle the **Undefined Vars as Null** switch above the **SQL template** to define the rule engine behavior:
275+
276+
- **Disabled** (default): The rule engine can insert the string `undefined` into the database.
277+
278+
- **Enabled**: Allow the rule engine to insert `NULL` into the database when a variable is undefined.
279+
280+
::: tip
281+
282+
If possible, this option should always be enabled; disabling the option is only used to ensure backward compatibility.
283+
284+
:::
285+
274286
9. Advanced settings (optional): For details, see [Features of Sink](./data-bridges.md#features-of-sink).
275287

276288
10. Before clicking **Create**, you can click **Test Connectivity** to test that the Sink can be connected to the Microsoft SQL Server.

en_US/data-integration/data-bridge-tdengine.md

+12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ This section demonstrates how to create a rule in the Dashboard for processing m
140140

141141
:::
142142

143+
If a placeholder variable is undefined in the SQL template, you can toggle the **Undefined Vars as Null** switch above the **SQL template** to define the rule engine behavior:
144+
145+
- **Disabled** (default): The rule engine can insert the string `undefined` into the database.
146+
147+
- **Enabled**: Allow the rule engine to insert `NULL` into the database when a variable is undefined.
148+
149+
::: tip
150+
151+
If possible, this option should always be enabled; disabling the option is only used to ensure backward compatibility.
152+
153+
:::
154+
143155
4. Click the + **Add Action** button to define an action to be triggered by the rule. With this action, EMQX sends the data processed by the rule to TDengine.
144156

145157
5. Select `TDengine` from the **Type of Action** dropdown list. Keep the **Action** dropdown with the default `Create Action` value. You can also select a TDengine Sink if you have created one. This demonstration will create a new Sink.

zh_CN/data-integration/data-bridge-clickhouse.md

+12
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ ClickHouse 数据集成是 EMQX 中的开箱即用功能,旨在结合 MQTT 的
124124
125125
:::
126126
127+
如果在模板中使用未定义的占位符变量,您可以切换**未定义变量作为 NULL** 开关(位于 **SQL 模板** 上方)来定义规则引擎的行为:
128+
129+
- **关闭**(默认):规则引擎可以将字符串 `undefined` 插入数据库。
130+
131+
- **启用**:允许规则引擎在变量未定义时将 `NULL` 插入数据库。
132+
133+
::: tip
134+
135+
如果可能,此选项应始终启用;禁用该选项仅用于确保向后兼容性。
136+
137+
:::
138+
127139
5. 点击右侧的**添加动作**按钮,为规则在被触发的情况下指定一个动作。通过这个动作,EMQX 会将经规则处理的数据发送到 ClickHouse。
128140
129141
6. 在**动作类型**下拉框中选择 `ClickHouse`,保持**动作**下拉框为默认的`创建动作`选项,您也可以选择一个之前已经创建好的 ClickHouse Sink。此处我们创建一个全新的 Sink 并添加到规则中。

zh_CN/data-integration/data-bridge-dynamo.md

+12
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ docker run --rm -e AWS_ACCESS_KEY_ID=root -e AWS_SECRET_ACCESS_KEY=public -e AWS
146146
"t/#"
147147
```
148148

149+
如果在模板中使用未定义的占位符变量,您可以切换**未定义变量作为 NULL** 开关(位于 **SQL 模板** 上方)来定义规则引擎的行为:
150+
151+
- **关闭**(默认):规则引擎可以将字符串 `undefined` 插入数据库。
152+
153+
- **启用**:允许规则引擎在变量未定义时将 `NULL` 插入数据库。
154+
155+
::: tip
156+
157+
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。
158+
159+
:::
160+
149161
::: tip
150162

151163
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。

zh_CN/data-integration/data-bridge-mysql.md

+12
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ CREATE TABLE emqx_client_events (
136136

137137
:::
138138

139+
如果在模板中使用未定义的占位符变量,您可以切换**未定义变量作为 NULL** 开关(位于 **SQL 模板** 上方)来定义规则引擎的行为:
140+
141+
- **关闭**(默认):规则引擎可以将字符串 `undefined` 插入数据库。
142+
143+
- **启用**:允许规则引擎在变量未定义时将 `NULL` 插入数据库。
144+
145+
::: tip
146+
147+
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。
148+
149+
:::
150+
139151
4. 点击右侧的**添加动作**按钮,为规则在被触发的情况下指定一个动作。通过这个动作,EMQX 会将经规则处理的数据发送到 MySQL。
140152

141153
5.**动作类型**下拉框中选择 MySQL,保持**动作**下拉框为默认的“创建动作”选项,您也可以选择一个之前已经创建好的 MySQL Sink。此处我们创建一个全新的 Sink 并添加到规则中。

zh_CN/data-integration/data-bridge-sqlserver.md

+12
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,18 @@ FileUsage = 1
255255

256256
:::
257257

258+
如果在模板中使用未定义的占位符变量,您可以切换**未定义变量作为 NULL** 开关(位于 **SQL 模板** 上方)来定义规则引擎的行为:
259+
260+
- **关闭**(默认):规则引擎可以将字符串 `undefined` 插入数据库。
261+
262+
- **启用**:允许规则引擎在变量未定义时将 `NULL` 插入数据库。
263+
264+
::: tip
265+
266+
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。
267+
268+
:::
269+
258270
4. 点击右侧的**添加动作**按钮,为规则在被触发的情况下指定一个动作。通过这个动作,EMQX 会将经规则处理的数据发送到 Microsoft SQL Server。
259271

260272
5.**动作类型**下拉框中选择 `Microsoft SQL Server`,保持**动作**下拉框为默认的`创建动作`选项,您也可以选择一个之前已经创建好的 Microsoft SQL Server Sink。此示例将创建一个全新的 Sink 并添加到规则中。

zh_CN/data-integration/data-bridge-tdengine.md

+12
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ CREATE TABLE emqx_client_events (
130130
"t/#"
131131
```
132132

133+
如果在模板中使用未定义的占位符变量,您可以切换**未定义变量作为 NULL** 开关(位于 **SQL 模板** 上方)来定义规则引擎的行为:
134+
135+
- **关闭**(默认):规则引擎可以将字符串 `undefined` 插入数据库。
136+
137+
- **启用**:允许规则引擎在变量未定义时将 `NULL` 插入数据库。
138+
139+
::: tip
140+
141+
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。
142+
143+
:::
144+
133145
::: tip
134146

135147
如果您初次使用 SQL,可以点击 **SQL 示例****启用调试**来学习和测试规则 SQL 的结果。

0 commit comments

Comments
 (0)