Document toolboxDocument toolbox

Devo Full Query

Description

This unit is a Source unit type.

This unit runs the query specified in its settings for each input event.

Output events are generated both to signal query operations and to deliver query results. 

An input event comes through the in port. Then, an event is sent to the init port to signal the start of the query. The query specified in the properties is executed. An event is sent through the data port for each result row.

The error port outputs an event every time there's an error running the query, retrieving new records, etc. The unit adds the field "action" to the output events with the value 'error', plus other standard error fields containing details about the error.

Finally, an event is sent through the end port every time a query ends, be it after an error, or when there are no more results. These events are the same as the input events, without any modification.

Configuration

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Description

Enter a description detailing the scope of the unit.

Query

The Devo query to be performed. This query can include parameters (defined in the 'parameters' field), that will be filled with the corresponding input event field.

Start time

You can specify a start time if you wish to test the query without input events. The unit will start sending data from that time included.

End time

You can specify an end time if you wish to test the query without input events. The unit will stop sending data from this time (excluded).

Parameters

A list of field names of the input events to be used as parameters in the query.

Map on

When defined, this is the name of the output event field if you wish it to contain a map from column names to values.

Kill current queries

As this is a passive unit, there can be a number of queries running simultaneously, depending on the number of threads (active units) providing data to it. Turn this on to kill previous queries before issuing a new query on a new input event.

Columns

Event field

The name of an input event field containing a list of (name, type) pairs.

Fields

Click the plus icon to add name-type pairs.

You can collapse and expand the pairs using the icons, reorder using the arrows, or delete using the X icon.

You can also reorder the fields using drag and drop.

Name

The name of an output event field where the query result will be inserted.

Type

The expected type for the query result (you can also write a java class qualified name).

From event

In this tab, you can specify values corresponding to input event fields, overriding previous settings. If no corresponding field is found in the input event, the default values are applied.

Query

Input event field containing the query. 

Start time

Input event field containing the start time.

End time

Input event field containing the end time.

Input ports

Port

Description

Port

Description

in

Each of the events in this stream will run the indicated query.

Output ports

Port

Description

Port

Description

init

Outputs an event every time a new query is launched (on each input event). These events are the same as the input events, without any modification.

data

Outputs an event for each query result row. The events generated are the input events extended with fields including the query results. Further required columns can be specified in the unit configuration options.

error

Outputs an event every time there's an error running the query, retrieving new records, etc. The generated event is an input event enriched with standard error messages.

end

Outputs an event every time a query ends, be it after an error, or when there are no more results. These events are the same as the input events, without any modification.

Example

In this example, we want to run a query that groups events every five minutes and adds a counter for how many events enter in this time period, inserting the results into a my.app table.

To do this, we will add a Tick unit to fire events. Then, add the Devo Full Query unit and enter the following query in its properties:

Then, we will define the destination table using the Devo Sink unit as a my.app table. Link the Data port of the Devo Full Query unit to the in port of the Devo Sink.

After saving and starting the Flow, you must click the red button of the Tick unit to begin sending events.

Download this example

You can try this flow by downloading the following JSON file and uploading it to your domain using the Import option:

Â