diff --git a/tutorials/sds-part2-create-streaming-project/create-a-new-project/1-create-a-new-project.png b/tutorials/sds-part2-create-streaming-project/create-a-new-project/1-create-a-new-project.png new file mode 100644 index 0000000000..5fda56ebab Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-a-new-project/1-create-a-new-project.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-a-new-project/2-select-streaming-project.png b/tutorials/sds-part2-create-streaming-project/create-a-new-project/2-select-streaming-project.png new file mode 100644 index 0000000000..cad841f600 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-a-new-project/2-select-streaming-project.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-a-new-project/3-provide-name-and-location.png b/tutorials/sds-part2-create-streaming-project/create-a-new-project/3-provide-name-and-location.png new file mode 100644 index 0000000000..fb9304be81 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-a-new-project/3-provide-name-and-location.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-a-new-project/4-click-finish.png b/tutorials/sds-part2-create-streaming-project/create-a-new-project/4-click-finish.png new file mode 100644 index 0000000000..0accc58959 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-a-new-project/4-click-finish.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/1-select-system.png b/tutorials/sds-part2-create-streaming-project/create-tables/1-select-system.png new file mode 100644 index 0000000000..a8f54b4f06 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/1-select-system.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/2-open-sql-console.png b/tutorials/sds-part2-create-streaming-project/create-tables/2-open-sql-console.png new file mode 100644 index 0000000000..4ecb5c30f5 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/2-open-sql-console.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/3-sql-console.png b/tutorials/sds-part2-create-streaming-project/create-tables/3-sql-console.png new file mode 100644 index 0000000000..3852d6e5ab Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/3-sql-console.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/5-execute-sql-query.png b/tutorials/sds-part2-create-streaming-project/create-tables/5-execute-sql-query.png new file mode 100644 index 0000000000..8f0f600a36 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/5-execute-sql-query.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/6-check-tables.png b/tutorials/sds-part2-create-streaming-project/create-tables/6-check-tables.png new file mode 100644 index 0000000000..e2f33154d6 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/6-check-tables.png differ diff --git a/tutorials/sds-part2-create-streaming-project/create-tables/7-check-content.png b/tutorials/sds-part2-create-streaming-project/create-tables/7-check-content.png new file mode 100644 index 0000000000..ef0f238103 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/create-tables/7-check-content.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/1-add-a-stream.png b/tutorials/sds-part2-create-streaming-project/new-stream/1-add-a-stream.png new file mode 100644 index 0000000000..fc66c67a4e Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/1-add-a-stream.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/10-drag-stream.png b/tutorials/sds-part2-create-streaming-project/new-stream/10-drag-stream.png new file mode 100644 index 0000000000..0df813bf6e Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/10-drag-stream.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/2-rename-a-stream.png b/tutorials/sds-part2-create-streaming-project/new-stream/2-rename-a-stream.png new file mode 100644 index 0000000000..55b6256a56 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/2-rename-a-stream.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/3-show-schema.png b/tutorials/sds-part2-create-streaming-project/new-stream/3-show-schema.png new file mode 100644 index 0000000000..88dda4d060 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/3-show-schema.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/4-add-column.png b/tutorials/sds-part2-create-streaming-project/new-stream/4-add-column.png new file mode 100644 index 0000000000..83136df2fc Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/4-add-column.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/5-add-5-columns.png b/tutorials/sds-part2-create-streaming-project/new-stream/5-add-5-columns.png new file mode 100644 index 0000000000..29556b13e9 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/5-add-5-columns.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/6-rename-column.png b/tutorials/sds-part2-create-streaming-project/new-stream/6-rename-column.png new file mode 100644 index 0000000000..80818a001d Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/6-rename-column.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/7-select-column-type.png b/tutorials/sds-part2-create-streaming-project/new-stream/7-select-column-type.png new file mode 100644 index 0000000000..e57722d81a Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/7-select-column-type.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/8-all-columns.png b/tutorials/sds-part2-create-streaming-project/new-stream/8-all-columns.png new file mode 100644 index 0000000000..bbd4f03d97 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/8-all-columns.png differ diff --git a/tutorials/sds-part2-create-streaming-project/new-stream/9-minimize.png b/tutorials/sds-part2-create-streaming-project/new-stream/9-minimize.png new file mode 100644 index 0000000000..a64e145d87 Binary files /dev/null and b/tutorials/sds-part2-create-streaming-project/new-stream/9-minimize.png differ diff --git a/tutorials/sds-part2-create-streaming-project/sds-part2-create-streaming-project.md b/tutorials/sds-part2-create-streaming-project/sds-part2-create-streaming-project.md new file mode 100644 index 0000000000..cc5d2291cd --- /dev/null +++ b/tutorials/sds-part2-create-streaming-project/sds-part2-create-streaming-project.md @@ -0,0 +1,169 @@ +--- +parser: v2 +auto_validation: true +primary_tag: products>sap-hana-streaming-analytics +tags: [ tutorial>beginner, products>sap-hana-streaming-analytics, products>sap-hana-studio ] +author_name: Bill Jiang +author_profile: https://github.com/BillJiangSAP +time: 20 +--- + +# Create a Streaming Project in SAP HANA Smart Data Streaming + Part 2 of 9. Create a SAP HANA Smart Data Streaming (SDS) project in SAP HANA Studio with streaming plug-in and visual editor. + +## Prerequisites + - **Tutorials:** [Configure SAP HANA Smart Data Streaming Server Connection](https://developers.sap.com/tutorials/sds-part1-configure-streaming-server.html) + +## You will learn + - Creating a new streaming project: a project contains one or more input streams/windows and then directs the flow of data through continuous queries and/or custom operators, publishing output events via adapters. + - Defining an input stream to receive incoming events: All incoming events enter a project via an input stream or input window. The schema of the input stream (or window) defines the fields that events on that stream will (or may) contain. + + +--- + +### Create a New Streaming Project + + +1. Click the **File** menu. You can also press **Alt+f**. Then click the **New** > **Project...**. You can also press **r**. + + ![Create a new Project](create-a-new-project/1-create-a-new-project.png) + +2. Click **New Streaming Project**, then click **Next**. + + ![Select Streaming Project](create-a-new-project/2-select-streaming-project.png) + +3. Enter `freezer_monitoring` in the **Name** box (be sure and only use lower case) and accept the default **Directory** location. + + ![Provide name and location](create-a-new-project/3-provide-name-and-location.png) + +4. Click **Finish**. You can also press **Alt+f**. + + ![Click Finish](create-a-new-project/4-click-finish.png) + + +### Create the Required SAP HANA Tables + + +1. Go to **SAP HANA Administration Console** perspective, then **Systems** view. Right click the system you are working with. + + ![open file](create-tables/1-select-system.png) + +2. Select **Open SQL Console** menu item to open a console that will automatically connect to your system. + + ![open file](create-tables/2-open-sql-console.png) + +3. Select the newly created SQL console tab. The tab window will have the title in the format of **` - SQL Console `** + + ![open file](create-tables/3-sql-console.png) + +4. Copy the code below into the SQL window. + + ```sql + --These are the SQL commands to set up the back-end tables for the Freezer Monitoring hands-on exercise. + + CREATE COLUMN TABLE "SYSTEM"."ACTIVITY_HIST" + ( "MACHINEID" VARCHAR(15), + "EVENT_TIME" TIMESTAMP, + "EVENT_NAME" VARCHAR(20), + "EVENT_DESCRIPTION" VARCHAR(30), + "EVENT_VALUE" VARCHAR(30) + ); + + CREATE COLUMN TABLE "SYSTEM"."DASHBOARD" + ( "MACHINEID" VARCHAR(15) NOT NULL , + "POWER_STATUS" VARCHAR(30), + "CURR_TEMP" DECIMAL(4,2), + PRIMARY KEY ("MACHINEID") + ); + + CREATE COLUMN TABLE "SYSTEM"."MACHINE_REF" + ( "MACHINEID" VARCHAR(15) NOT NULL , + "MACHINETYPE" VARCHAR(15), + "MAX_TEMP" DECIMAL(4,2), + "MIN_TEMP" DECIMAL(4,2), + "LOCATION" VARCHAR(25), + "TEMP_UNIT" VARCHAR(2), + PRIMARY KEY ("MACHINEID") + ); + + CREATE COLUMN TABLE "SYSTEM"."POWER_OUTAGES" + ( "MACHINEID" VARCHAR(15), + "POWER_OFF_TIME" LONGDATE, + "POWER_ON_TIME" LONGDATE, + "DURATION_MIN" DOUBLE CS_DOUBLE + ); + + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( '2DDDBW3TP','VEND',50,35,'WALG31','F'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( 'EKM49RTXK','COOL',50,35,'FRI7','F'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( 'RB82KMY3S','VEND',50,35,'JRB235','F'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( '4CBH7792RN','COOL',50,35,'WALG33','F'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( 'JMD51RTKK','VEND',10,2,'BP762','C'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( 'GGR23RTXK','FREEZE',32,0,'HIN88','F'); + INSERT INTO "SYSTEM"."MACHINE_REF"("MACHINEID", "MACHINETYPE", "MAX_TEMP", "MIN_TEMP", "LOCATION", "TEMP_UNIT") VALUES + ( '8HRT4WX2','VEND',50,35,'ORD311','F'); + + ``` + +5. Execute the SQL script by pressing the **Execute** button. + + ![execute query](create-tables/5-execute-sql-query.png) + +6. Confirm that they executed correctly. You should have these tables. + + ![check tables](create-tables/6-check-tables.png) + +7. Check to see that all tables created are empty except for **`MACHINE_REF`** which will have 7 rows of data. + + ![check content](create-tables/7-check-content.png) + + + +### Create an Input Stream + + +1. When you created the project, it created an input stream called "NEWSTREAM" by default. + + ![add a stream](new-stream/1-add-a-stream.png) + +2. 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](new-stream/2-rename-a-stream.png) + +3. Click on the **+** to the left of Schema to expand it. + + ![show schema](new-stream/3-show-schema.png) + +4. Now hover the cursor over the right edge of the **MACHINEDATA** shape so that the toolbar appears. Click on the **Add Column** tool. + + ![add column](new-stream/4-add-column.png) + +5. Repeat step 5 three more times, so there are a total of 5 columns. + + ![add 5 columns](new-stream/5-add-5-columns.png) + +6. Double click on the name **`Column1`** and change the name of this column to **MACHINEID**. + + ![rename column](new-stream/6-rename-column.png) + +7. 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**) + + ![select column type](new-stream/7-select-column-type.png) + +8. Change the rest of the column names and data types as shown: + + ![all columns](new-stream/8-all-columns.png) + +9. Click here **-** to collapse the shape. + + ![minimize](new-stream/9-minimize.png) + + Note: You can just drag the shape to a new position to organize our diagram. + + ![drag stream](new-stream/10-drag-stream.png) +