Skip to Content

Create a Streaming Project with SAP HANA Streaming Analytics

0 %
Create a Streaming Project with SAP HANA Streaming Analytics
// Explore More Tutorials

Create a Streaming Project with SAP HANA Streaming Analytics


Create a SAP HANA Streaming Analytics project using the streaming plug-in for Eclipse.

You will learn

  • How to create a new streaming project
  • Define an input stream to receive incoming events, including the field structure (schema) for the incoming events
  • Add a filter to apply to the event stream

In this tutorial series we will be building a project using a simple Internet of Things (IoT) scenario. Our project will be designed to monitor a set of freezer units that are equipped with sensors to report temperature, power on/off events, and door open/close events. We will apply various operators to analyze and transform this data, generate alerts, and capture information in the HANA database.

Step 1: Create a new streaming project

Click the File menu. Then click the New > Project….

Create a new Project

Expand SAP HANA streaming analytics and select New Streaming Project, then click Next.

Select Streaming Project

Enter freezer_monitor in the Name box (be sure to only use lower case) and accept the default Directory location.

Provide name and location

Click Finish.

Step 2: Create an Input Stream

All events enter a streaming project via an input stream or input window. When you created the project, it created an input stream called “NEWSTREAM” by default. We will use that stream and just rename it. Alternatively you could add another input stream (or window) by dragging it from the palette and dropping it into the project diagram.

add a stream

Click the icon to the left of the name NEWSTREAM and change the name of this stream to MACHINEDATA, then press Enter key.

rename a stream

Note that stream names are case sensitive

Step 3: Define columns for each field in the incoming events

Streams and windows all have a fixed set of typed columns (aka schema). Events arriving on a particular input stream must contain a set of fields that is compatible (number and type of fields) with the input stream. Events with different field sets will typically be processed by different input streams.

Click on the + to the left of Schema to expand it.

show schema

Select the MACHINEDATA shape so that the toolbar appears. Click on the Add Column tool.

add column

Click on Add Column three more times, so there are a total of 5 columns.

add 5 columns

Double click on the name Column1 and change the name of this column to MACHINEID.

rename column

Double click on (INTEGER) to the right of MACHINEID to change the datatype for this column to string. (after double clicking, click the drop down arrow, and select string)

Change the rest of the column names and data types as follows:

Note that column names are case sensitive

Column Name Type

Your stream should look like this:

all columns

Click here - to collapse the shape.


Note: You can just drag the shape to a new position to organize our diagram.

drag stream
Step 4: Add a filter

Drag and drop the Filter item in the Streams and Windows drawer of the Palette into the canvas.

add filter

Rename the stream, Filter1, to ACTIVITY_HIST by clicking on the filter icon.

Step 5: Connect it to an event stream

Select Connector from the Palette.


Click on the MACHINEDATA shape and then on the ACTIVITY_HIST shape in the visual editor to connect them, directing the data flow from the input stream to the filter.

Step 6: Define the filter criteria

Double-click on the 1 under ACTIVITY_HIST > Filter to edit the filter expression.

filter expression

Enter MACHINEDATA.EVENT_NAME='DOOR' in the text box to define the filter expression.

Note that you can use Ctrl+Space for content assist. Confirm your entry by pressing the Enter key.


Click on the All Iconic button (icon shown below) to collapse all the items.

collapse all

Next Steps

Back to top