You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test your InfluxDB 3 plugin safely without affecting written data. During a plugin test:
147
+
Use the [`influxdb3 test wal_plugin`](/influxdb3/version/reference/cli/influxdb3/test/wal_plugin/)
148
+
CLI command to test your processing engine plugin safely without
149
+
affecting actual data. During a plugin test:
148
150
149
151
- A query executed by the plugin queries against the server you send the request to.
150
152
- Writes aren't sent to the server but are returned to you.
151
153
152
-
To test a plugin, do the following:
154
+
To test a plugin:
153
155
154
-
1.Create a _plugin directory_--for example, `/path/to/.influxdb/plugins`
155
-
2.[Start the InfluxDB server](#start-influxdb) and include the `--plugin-dir <PATH>` option.
156
-
3. Save the [example plugin code](#example-python-plugin-for-wal-rows) to a plugin file inside of the plugin directory. If you haven't yet written data to the table in the example, comment out the lines where it queries.
157
-
4. To run the test, enter the following command with the following options:
156
+
1. Save the [example plugin code](#example-python-plugin-for-wal-rows) to a
157
+
plugin file inside of the plugin directory. If you haven't yet written data
158
+
to the table in the example, comment out the lines where it queries.
159
+
2. To run the test, enter the following command with the following options:
158
160
159
161
-`--lp` or `--file`: The line protocol to test
160
162
- Optional: `--input-arguments`: A comma-delimited list of `<KEY>=<VALUE>` arguments for your plugin code
Replace the following placeholders with your values:
175
+
Replace the following:
174
176
175
177
- {{% code-placeholder-key %}}`INPUT_LINE_PROTOCOL`{{% /code-placeholder-key %}}: the line protocol to test
176
178
- Optional: {{% code-placeholder-key %}}`INPUT_ARGS`{{% /code-placeholder-key %}}: a comma-delimited list of `<KEY>=<VALUE>` arguments for your plugin code--for example, `arg1=hello,arg2=world`
177
179
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database to test against
178
180
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: the {{% token-link "admin" %}} for your {{% product-name %}} server
179
181
- {{% code-placeholder-key %}}`PLUGIN_FILENAME`{{% /code-placeholder-key %}}: the name of the plugin file to test
180
182
181
-
The command runs the plugin code with the test data, yields the data to the plugin code, and then responds with the plugin result.
182
-
You can quickly see how the plugin behaves, what data it would have written to the database, and any errors.
183
+
The command runs the plugin code with the test data, yields the data to the
184
+
plugin code, and then responds with the plugin result.
185
+
You can quickly see how the plugin behaves, what data it would have written to
186
+
the database, and any errors.
183
187
You can then edit your Python code in the plugins directory, and rerun the test.
184
188
The server reloads the file for every request to the `test` API.
185
189
186
-
For more information, see [`influxdb3 test wal_plugin`](/influxdb3/version/reference/cli/influxdb3/test/wal_plugin/) or run `influxdb3 test wal_plugin -h`.
187
-
188
190
With the plugin code inside the server plugin directory, and a successful test,
189
191
you're ready to create a trigger for your server to run the plugin.
190
192
191
193
##### Example: Test and run a plugin
192
194
193
-
The following example shows how to test a plugin, and then create the plugin and
194
-
trigger:
195
-
195
+
<!-- pytest.mark.skip -->
196
196
```bash
197
197
# Test a plugin
198
198
# Requires:
@@ -207,6 +207,16 @@ influxdb3 test wal_plugin \
207
207
test.py
208
208
```
209
209
210
+
For more information, see [`influxdb3 test wal_plugin`](/influxdb3/version/reference/cli/influxdb3/test/wal_plugin/)
211
+
or run `influxdb3 test wal_plugin -h`.
212
+
213
+
## Create a trigger
214
+
215
+
With the plugin code inside the server plugin directory, and a successful test,
216
+
you're ready to create a trigger to run the plugin. Use the
The `query` subcommand includes options to help ensure that the right database is queried with the correct permissions. Only the `--database` option is required, but depending on your specific setup, you may need to pass other options, such as host, port, and token.
19
38
@@ -83,7 +102,217 @@ Replace the following placeholders with your values:
83
102
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database to query
84
103
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "database" %}}{{% show-in "enterprise" %}} with permission to query the specified database{{% /show-in %}}
85
104
86
-
### Query using the API
105
+
To query from a specific time range, use the `WHERE` clause to designate the
0 commit comments