Print

Query OUTPUT

The OUTPUT clause indicates what plugin should handle the output whenever triggered by a query.
RioDB uses plugins to direct the output action. This enables additional plugins to be added and increase integration options without having to modify the RioDB core.

The OUTPUT clause is optional. If a query does not have the OUTPUT clause, then the query is interpreted as a on-time query. Instead of being deployed to run continuously, the query will return a one-time result if conditions are ever matched before the RioDB API times out.

Note, one-time queries are also executed each time a stream message is received, and they will continue to be executed until conditions are met, or the RioDB API times out, whichever occurs first. If a stream is not receiving messages, the API will just timeout eventually.

The OUTPUT must indicate what plugin to be used. The plugin must have been previously installed. (More information about installing plugins can be found in the plugins pages.)

Each plugin is different. Therefore, the OUTPUT clause is followed by plugin-specific configuration provided within parenthesis.

At the time of this writing, RioDB queries can only have ONE output. But there are plans to support multiple outputs triggered by the same query.

Syntax

Without plugin-specific configuration:

OUTPUT <plugin name>

Now with plugin-specific configuration properties. Newlines are ignored, but useful for code readability:

OUTPUT <plugin name> (
    <propery 1> <value 1>
    <propery 2> <value 2>
    <...> <...>
    <propery n> <value n>
)

Example

STDOUT is an example of an output plugin that does not require any properties. STDOUT is only available for on-prem deployments.

SELECT ...
FROM ...
WHEN ...
OUTPUT stdout;

The HTTP output plugin requires properties:

SELECT ...
FROM ...
WHEN ...
OUTPUT HTTP (
    url 'http://localhost:2338'
    method 'POST'
    content_type 'text/plain'
    delimiter ','
);

More OUTPUT plugins are documented in the Plugins -> OUTPUT documents

Table of Contents
Scroll to Top