From Wroclaw to Berlin and back: IoT analysis with SAP Lumira via jdbc
In my previous post I used OData to access my data in SAP HCP IoT Service from SAP BusinessObjects Lumira. That approach has its limitations, so now I am going to try another way. SAP HCP allows developers to create a trial SAP HANA MDC database. I created a HANA instance called ‘vitalmdc‘ in my trial HCP account and then configured IoT MMS service to store data in that HANA MDC database.
If you are not familiar with SAP HANA development yet at all, then please check tutorials available at Tutorials Navigator – Beginners.
SAP HCP does not offer direct access to HANA instances and schemas for external applications, like SAP BusinessObjects Lumira. But HCP SDK provides a consol client, which allows HANA Cloud Platform users to open a tunnel to their SAP HANA databases hosted by HCP. And that’s what I did:
Now my instance of HCP-hosted HANA db is visible to applications on my laptop as local instance number ‘00‘ running on the host ‘localhost‘. I am going back to Lumira application and acquiring a dataset similarly to my previous blog post, ie from the source ‘Query with SQL’, but this time selecting ‘SAP HANA – JDBC Driver’ as the database.
Now just populating connection parameters:
- HANA DB details returned by the tunnel upon establishing connection, ie. ‘localhost‘ and instance nr ‘00‘
- DB user (not HCP user!) credentials. I used the default system user ‘SYSTEM‘, which obviously was not the best choice, but it was quick and dirty decision.
If tunel remains open and all parameters are correct, then you should successfully connect to your HANA DB’s catalog. In my case I am looking for my IoT tables, and more specifically want to select again the timestamp and the altitude data from T_IOT_A7B01790F3E80BC544A3 table:
select C_TIMESTAMP, C_ALTITUDE from "SYSTEM"."T_IOT_A7B01790F3E80BC544A3" order by 1
Now just click [Create] and data got acquired as a Lumira’s dataset for further discovery and visualization with all 412 records:
If you are not familiar with data discovery and visualization using SAP BusinessObjects Lumira, then review Tutorial Catalog for SAP BusinessObjects Lumira.
Now I just need to:
- Convert C_ALTITUDE to a number. This creates a new C_ALTITUDE (2) dimension.
- Create a measure based on C_ALTITUDE (2) dimension.
- Change aggregation for C_ALTITUDE (2) from default ‘Sum’ to the ‘Average’.
- Now in Visualize room in Lumira choose ‘Line Chart for Date/Time Series’
- Add C_ALTITUDE (2) as Y Axis’s Measure and C_TIMESTAMP as Time Dimension and get the elevation profile as I was driving from Berlin to Wrocław:
My trip’s starting point in Berlin was at 46.83m above the sea level, which seems about right comparing to Berlin Environmental Atlas. Then I turned data roaming on just a few times, before getting to Poland. The phone connected to domestic network at 18:39:09, and then constantly collected metric until I reached home in Wrocław. Finish was at 121.78m above the sea level accordingly to SensorPhone post, and Google Maps shows 120m for the same.
Next I plan to do some SQL calculations on data in SAP HANA MDC instance, including window functions and geospatial processing.