Sneak Peek into HANA as a Service: Database Artifacts and Calculation Views
This tutorial explains how to create some database artifacts, including a Calculation View with K anonymization, in your instance from SAP Web IDE Full Stack.
Join the DZone community and get the full member experience.Join For Free
Here's an overview of how to create some database artifacts, including a Calculation View with K anonymization, in your instance from SAP Web IDE Full Stack.
Philip Mugglestone already published great video tutorials on how to deploy your instance and connect to it. If you can't see the option to create the service, remember that as of today, this is not available through trial.
This instance of mine has been created with the scriptserver option on:
We could use the new CAP model to build an app but the good ol' MTA wizard also does the trick.
There are only minor differences with the already documented XSA path. After all, XS Advanced is our HANA-friendly, on-premise version of Cloud Foundry.
Most of these differences come from using SAP Web IDE for Full Stack as opposed to SAP Web IDE for HANA. Again, these are minor and this wizard to create an MTA and a DB module altogether is one of them (compared to the currently available one in HANA Express).
Please remove that namespace; you don't need it and it only makes names longer:
You need to enable the plugins for Web IDE for the database explorer and other fun stuff if you haven't already:
I will change things a little bit from those tutorials and create a different data model. My single table (.hdbtable) will be called JOBS.
If you want something similar to follow along, here is another tutorial that will also explain how to create the calculation view.
Fast forwarding, I am also loading data with a CSV file and an hdbtabledata configuration.
If I build the module, I get a table with data in the database explorer:
If you get an error when building the module, make sure the space is set in your cloud Foundry options or the project settings. And of course, having a service of type "hana" in that same space is super important, otherwise, Web IDE will have nothing to bind to.
You could also get an error for having more than one HANA service in the same space (lucky you!). Use parameter "database-id" and the GUID for your database (you can find this at the Database Cockpit):
When you build the module, Web IDE will also create an HDI container for you.
You could manually create the HDI container using the Command Line Interface or with this graphical option here:
But there is no need because Web IDE created it for you. If you click on that tile, you will see the instance of the service:
If you list the services using the CLI, you will also see the HDI container, which also translates to a schema with vitamins. So why do you see it as a service? How is it both a schema AND a service?
Because this service will manage the database artifacts for you. It will have its own technical user that will access the actual physical database (and physical schema, which it also created for you).
In other words, you only have to worry about creating the design-time artifacts like the hdbtable. The technical user that gets created automatically with your container will use its authorizations and superpower to execute the actual "CREATE TABLE" statement in actual physical schema.
Also with a twist, using an intuitive form of anonymization. If you want to create your own modeling and haven't tried it yet, here are some more step-by-step tutorials.
Those include more fancy tricks like a Star Join and Currency Conversion (something I would have killed for back in the HANA Studio days).
Ta-da! Calculation views and the whole enchilada in your SAP HANA Service!
Easy, eh? So what if you wanted to expose this through OData?
Well, you just do! I might explain that in a future post.
In the meantime, if you do not have such an instance but are willing to learn HANA, remember there is a free alternative with SAP HANA, express edition.
All of the tutorials I mentioned here were created for and in HXE.
Published at DZone with permission of Lucia Subatin, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.