In this blog i will explain how we can fetch the IoT Data from our HCP to our OnPremise landscape via SAP HCI-DS and the SAP Data Services Agent.
Please check the first blog to get an complete overview abou the story Use SAP HCP IoT Services and HCP Integration Services (HCI-DS) to get your Sensor Data – Part 1
To get the data from our Tables we are usin SAP HANA Cloud Integration Data Service.
Log on to SAP HCI-DS via HANA Cloud Integration and enter your Organizatzion Name:
Create the Source Data Store
After you have successfully logged in we starting to create and new datastore to connect the HCP with the HCI DS.
Press the + button and fill the requiered fields, as Type select “SAP HANA application Cloud“
The Access Token is required to provide schema access for HCI DS.
Get the SDK
Get the SAP HANA Cloud Platform SDK and extract the archive on your favorite location and open an command prompt an enter the following commands.
List the schema on your HCP:
neo list-schemas -h hana<trial>.ondemand.com -a <HCP Account> -u <suser> -p <password>
Get the Acces Token:
neo grant-schema-access -i IoT -a <HCP Account> -h hana<trial>.ondemand.com -u <suser>-b hcids:dsprod
In my case the schema is already bound, so i want list my access token:
neo list-schema-access-grants -a <HCP Account> -h hana<trial>.ondemand.com -u <suser> -i IoT
Now we are ready and can use the access token in HCI-DS:
After the HCP data store is successfully added you are able to acces the HCP tables:
Create the Targe Data Store
In this scenario i want to replicate my IoT data to a simple flat (csv) file, so we create a second one.
as Type select “File Format Group” and specify the target directory.
Add the table which u want to consume:
Define the format details:
As result you can now see the assigned table and the corresponding columns:
Create a Project and Task
Now we change to the Projects tab an create an new project and an new task.
Choose the source (our HCP data store):
….and the target:
As result we have now an project with an corresponding task:
Now we can define our data flow by click on edit:
To define the data flow, first add the target object:
Now you can define what data you want to get, in my case i use all fields from the target (HCP).
I choose as source the same tabel as defined above by craeting the target source:
by clicking on the “Target_Query” object u can define the mapping between source and target:
Now you can creae the scheduler to define the intervall of the replication.
As prerequisite you nedd an active SAP Data Service Agent on your OnPremise Landscape.
In the next blog i will show you how to install the SAP Data Services Account and connect them with your SAP HCP and fetch the IoT Data.