HANA Native Developer experience in the HANA Cloud Platform: A problem solved
Note: There is a no-agreed upon definition of “developer experience” – so in this blog, I’ll be using a very broad interpretation.
I totally agree that there are three different dev experiences (Native, Integrated and Open) but where I disagreed was the restriction of the dev experiences to particular parts of the HANA Cloud Platform (HCP).
I think it is also interesting that you distinguish between the HANA DB and HANA Native development. For me, the two are inseparable; therefore, I find the current inability to use native development in the Java PaaS such a major problem.
Here is how Aiaz’s responded to my comment:
HANA provides database and application server capabilities that can be accessed through native application development. No separation was implied – so you are right – they are inseparable. Now about the Open dev experence through Java – by its very nature you are using a JVM /Java App Server/ run-time – so the app development is not native at the outset. As part of the product evolution I know the team is looking at supporting access to more of HANA’s underlying data management, predictive, text search etc. capabilities. I’d like to see more use cases that require this
I considered this reply a challenge, so I decided to blog about such scenarios.
Before we begin, let’s define a few topics that will be relevant for our upcoming discussion.
What is the HANA Cloud Platform?
Here is Aiaz’s definition:
SAP HANA Cloud Platform is SAP’s in-memory cloud platform, our Platform-as-a-Service offering enabling developers to build, extend, and run applications in the cloud. It provides developers a set of application and database services and features native, integrated and open developer experiences [SOURCE].
Here is his diagram of the HANA Cloud Platform:
[SOURCE] (I’ve added RDL to this diagram)
What is the HANA Platform?
Here is the marketing description:
SAP HANA is an in-memory data platform that is deployable as an on-premise appliance, or in the cloud. It is a revolutionary platform that’s best suited for performing real-time analytics, and developing and deploying real-time applications. At the core of this real-time data platform is the SAP HANA database which is fundamentally different than any other database engine in the market today
Here is the diagram of the HANA Platform.
Although not explicitly shown in the diagram, HANA XS is also part of the HANA Platform in that it can also be used in a variety of environments including OnPremise HANA deployments.
Note: As usual, I’m starting with relatively simple diagrams and building on them – so bear with me.
We now have two platforms that are related to one another.
The HANA Cloud Platform (HCP) includes the HANA Platform. I’m purposely describing the additional functionality vaguely as “Cloud Stuff” – but I’m assuming it is the Extended and Application services layers.
Now let’s add the developer experiences:
Now, let’s take a closer look at the Hana Cloud Platform – at least in current form. What we are going to do is associate the developer experiences described by Aiaz and associate them with concrete parts of the HCP.
Note: RDL is a special case. It is currently not publicly available and will just be part of the SPO7 release planned for December 2013 – yet since it is a design time tool that generates native code, I’m going to associated it with the Native development experience.
Now let’s zoom into the HANA Cloud Platform. We are going to split up the two main groups– HANA Platform and the Cloud Stuff. The HANA Platform is manifested in the form of the HANA One offerings and to some degree the HANA Enterprise Cloud. The “Cloud Stuff” is the PaaS offering with a HANA DB hidden under the covers.
Why is a change necessary?
The power of HANA requires a shift in how developers look at the database.
Here is a slide that shows the impact on ABAP developers
Developers working with the HANA Cloud Platform should also be provided with similar possibilities and this functionality requires access to the native developer experience. Being able to exploit HANA usually requires the creation of procedures in SQLScript, etc.
If we consider larger developer teams where different roles (UI developer, HANA native developer, Java developer, etc) are involved, then each role has their own accustomed developer environment / toolset which optimized for the task in question. A Java developer can use a text editor to create his code but he won’t be as efficient as if he was using Eclipse. This means that someone working natively in HANA requires the HANA Studio.
I’m not alone
Lately, I have watching the HANA Cloud Platform forums on SCN and have seen an increasing number of developers who have similar needs:
Also, is there any way we can view the database for the HANA Cloud DB? I found a way for that only for MaxDB, not for HANA DB. [SOURCE]
I have deployed my server artifact and deployed on hanatrial space. I would like to access the database (Hana Database) in the studio.Is it possible to access the database? Can you please share the username and password to access the database? [SOURCE]
Just wondering can we deploy this application on HANA Cloud Platform anyhow, as it also acts as the application server. [SOURCE]
Please let me know how can we use HANA DB on HANA cloud from with in our Java application for Analytic’s.
We are already using HANA for persistence but now want to leverage the PAL capabilities are well.
From HANA documentation its clear that there are some steps that need to be followed in order to achieve this such as: creating AFL_WRAPPER_GENERATOR and generating a PAL Procedure etc.
On HANA Cloud how do we proceed to do this. Or is this available via JNDI or through some other stored procedure that cloud already provides and application can call. HANA Cloud documentation points nothing in this direction so I am clueless. Please help. [SOURCE]
An initial solution
While exploring the SAP guthub repo, I found an interesting project called “cloud-hana-scriptview-demo” which has the following description:
This is a sample web application showing how one could use SAP HANA Scripted Views in SAP HANA Cloud Platform. The application also aims to show the benefit of using “Remote Database Access” tools provided by “SAP HANA Cloud SDK 2.x. #cloud-sample
The same developer Dimitar Tenev had created a similar project called cloud-hana-search-demo that I also been watching. In this project, Dimitar was working with what looked like HANA-specific code (I wasn’t sure based on the syntax of the procedure that he used in this project).
As I was looking in the newer project, I finally found what I was looking for. Here is the procedure that was being loaded:
CREATE PROCEDURE "manager/SCRIPTVIEW/proc" ( OUT var_out "manager/SCRIPTVIEW/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data AS
result = SELECT * FROM "MANAGERS";
var_out = SELECT
A."BUDGET"*100/(select sum("BUDGET") from "MANAGERS") as "BUDGET_PERCENTAGE_SHARE"
FROM :result A;
This was indeed HANA-specific code (sqlscript) that was being loaded directly into the HANA DB via a java-loader.
Finally, I had found proof that it was really possible to work with the underlying HANA DB with native code.
In a comment on his HANA-search blog, Dimitar describes how they created their native code.
We used HANA Studio (connected to our local HANA server) to create/test the SQL code for the search demo application. We wrote procedure by hand in HANA SQL editor.
The associated native developer experience for HCP devs was complicated and involved two different two toolsets – not ideal but it worked.
Ask and you shall receive
The Remote Database Access Tool (beta) now provides a SAP HANA studio integration feature that allows you to remotely access the SAP HANA database.