The latest version of HANA, “SAP HANA Cloud” was recently released in April 2020.
It is a cloud “DataBase as a Service” product. It means you can create an instance in a few minutes, it has built-in high availability, elasticity, and is requires much less maintenance work than an on-premise deployment.
SAP HANA Cloud manages data storage, federation, and helps you run powerful applications.
It offers one data access layer across all data sources, which means you can access other data sources through HANA Cloud without having to replicate everything.
It offers a fast and simple interface for administrators to optimize their data landscape.
- Native Storage Extension : multi-temperature storage. SAP HANA Cloud data tiering means you can move your data between the in-memory storage, SAP HANA native storage extension, and the relational data lake.
- Relational Data Lake (SAP IQ deployed in the cloud), supporting petabyte storage for SQL on disks. This also supports document, graph and spatial data types.
- Ability to access data without replication through data virtualization for many data sources– SAP and non-SAP, cloud and on premises.
- It is the first cloud-native SAP HANA service: elastic, resilient, supports consumption-based licensing, no frontloaded costs to use it.
SAP Analytics Cloud enables business users to perform visualization, planning, and prediction on any data source. It offers live data connectivity to SAP HANA Cloud Services so business users can self-serve across from a single, trusted, enterprise data source.
SAP Data Warehouse Cloud is a fully managed, cloud-native, data warehouse that provides users the concept of spaces ensuring data access and governance. It can consume data residing in SAP HANA Cloud Services. Both SAP Analytics Cloud and SAP Data Warehouse Cloud are running on top of SAP HANA Cloud as the database layer to give users performant, secure, access to data. Data Warehouse Cloud provides an additional layer to HANA Cloud that transforms your data to a solid and trusted data foundation for decision making processes. It includes semantic modelling capabilities, flow modelling, process chains, data lineage, advanced analytics and data visualization by addressing business users and data warehouse developers. HANA Cloud serves as the underlying data platform addressing database administrators and HANA developers.
For those who want to know more about SAP HANA’s use cases and history, have a look at this series by Denys Van Kempen.
This blog’s objective is to provide you with the basics to start working with SAP HANA Cloud. It is based on the official reference for SAP HANA Cloud, and the HANA Academy HANA Cloud guide.
Create your SAP HANA Cloud instance
Let’s start by creating an instance of SAP HANA Cloud. Access the SAP Cloud Platform Cockpit.
As of July 2020, this can now be replicated with a trial account.
If you are an SAP Employee, access this page to grant the service plans to your SAP Cloud Platform account.
Open a global account which has a service plan active for
– SAP HANA Cloud(hana, hana-cloud-connection, relational-data-lake) : this is necessary to create instances of HANA Cloud and Relational Data Lake.
– SAP HANA Schemas & HDI Containers(schema or hdi-shared) : this is necessary to build services linking to HDI Containers or schemas.
– Application Runtime(MEMORY) : this is necessary to deploy HDI containers and run applications.
With the global account role of administrator, assign these service plans to the subaccount in which you will create the SAP HANA Cloud instance.
Switch to the “subaccount” tab, and select the subaccount in which you want to work. Click on entitlements, and “Configure entitlements”.
With the subaccount role organization manager, add the service plans hana, hana-cloud-connection, relational-data-lake, hdi-shared or schema, MEMORY to the subaccount in which you will create the SAP HANA Cloud instance. Within the service plans, you can limit entitlements for the Application Runtime : how many GiB of memory you allow developers to use for running applications. In this example, I am allocating 4GiB out of 5GiB available for development.
Assigning service plans and entitlements allow administrators to decide who can use resources within the organization.
You can now enter the space in which you will work, click on “SAP HANA Cloud” on the left panel, then on “Create Instance”.
Assign a name to your instance and a password to your administrator user.
Choose the memory size of your SAP HANA instance, between 30GB and 900GB. Compute power and storage are automatically assigned.
Optionally, you can create a Relational Data Lake.Set the number of virtual CPUs and the storage.
Finally, you can decide which IP addresses are allowed to access the SAP HANA Cloud instance.
After a few minutes, the instance is up and running. You can now access it from the SAP HANA Cockpit and the SAP HANA Database explorer.
You can edit it, reduce or increase its size by clicking on the pencil icon, and delete it with the trash can.
The Relational Data Lake is also up and running. You can edit it, reduce or increase its size and delete it. To access it, you can use the SAP HANA Database Explorer and the Web IDE Full-stack.
Let’s open the SAP HANA Cockpit. It provides tools for the administration and monitoring of your SAP HANA database. You can manage users and system parameters, monitor performance, jobs and SQL statements.
When you first open it, it asks you to enter credentials. Enter DBADMIN and the password you just set up.
From this point, you can already use the SAP HANA Database Explorer and interact with your SAP HANA Cloud database through SQL.
In the next step, we will use the SAP Web IDE Full-stack to build a simple database application.
Design tables and views
Go back to the SAP Cloud Platform Cockpit and open the SAP Web IDE Full-Stack to start designing database objects.
If you have never worked with Web IDE before, Check this tutorial. You will need to set it up, and grant your users the necessary roles for development, and activate two extensions for SAP HANA development.
Switch to Preferences>Extensions and enable the following extensions : SAP HANA Database Development Tools and SAP HANA Database Explorer
Set up the Cloud Foundry Space, then your Database Explorer to the space in which you created you HANA Cloud instance.
In the Web IDE, design-time objects and run-time objects are managed separately.
This allows developers to keep control on the objects they created, and makes communication between team members much easier.
In the development pane of the Web IDE Full-Stack, you can find your own workspace.
This workspace is isolated: whatever you define within this workspace can only be accessed by your user. To share their code, developers commonly use a centralized Git repository, or alternatively share by exporting and importing projects as Zip files.
Having an isolated workspace allows developers to isolate their work from other developers to concentrate on their own work without being distracted by changes that other people make. But how is this isolated behaviour reflected when you create objects that need to be pushed to HANA?
Inside a workspace, you can set up projects that contain HANA Database modules. By default, the Web IDE builds each HDB module into a developer specific HANA Deployment Infrastructure (HDI) container, which on the database is represented by one main schema, and several other objects that hold metadata.
Right-click on the work space and create a new project from a template. Select multi-target application, and follow the wizard.
Right-click on your newly created project and choose New>SAP HANA Database module. Follow the wizard to build a db module.
Now let us create tables. Right-click on the src folder and select New>File.
A pop-up comes up, insert tables/airports.hdbtable
This will create a tables folder with a file called airports.hdbtable.
In SAP HANA Cloud, we use HDBTable files to create tables. This file is a design-time artifact, which will create a table when we build the HDI container. It allows us to keep track on the definition of all our tables, and re-use them easily. HDBTable Syntax reference
COLUMN TABLE "AIRPORTS" ( "AIRPORTCODE" INTEGER, "AIRPORTNAME" NVARCHAR(256), "CITY" NVARCHAR(256), "COUNTRY" NVARCHAR(256), "LOCATION" ST_GEOMETRY(4326), "ALTITUDE" INTEGER, "OFFSETUTC" INTEGER, "PASSENGERS" INTEGER, PRIMARY KEY ("AIRPORTCODE") )
Learn more about SAP HANA supported SQL data types.
And in particular for this table I am using a location column, using SAP HANA Spatial’s capabilities. 4326 is the Spatial Reference system. Learn more about Spatial data here.
Let’s create a second table with the Web IDE has built-in artifact menu.
Right-click the tables folder, and select New>Data base artifact.
This opens a wizard with a list of all available artifacts on SAP HANA Cloud. Choose .hdbtable and give it the name “routes“. This will create routes.hdbtable
Insert the definition of the second table.
COLUMN TABLE "ROUTES" ( "ROUTEID" INTEGER, "AIRLINECODE" NVARCHAR(2), "AIRLINENAME" NVARCHAR(256), "ALLIANCENAME" NVARCHAR(256), "AIRPORTCODEORIGIN" NVARCHAR(3), "AIRPORTCODEDESTINATION" NVARCHAR(3), "DISTANCE" INTEGER, "DURATION" INTEGER, PRIMARY KEY ("ROUTEID") )
We have seen that users can define tables directly with files using the .hdbtable extension, or by selecting “new> database artifact” in the wizard. The result is the same.
Build tables and access them through the Database explorer
Now that you have created two design-time tables, we need to build them so that they are created as actual tables on SAP HANA. Right-click your src folder, select Build>Build Select Files.
When the build process finishes, switch to the database Explorer of the Web IDE. You will need to log in with your SAP Cloud Platform user the first time you use it. Then, click on the + on top of the screen and add the HDI Container you just built.
When you add the HDI container, its content becomes accessible on the left panel. Click on your tables and see their definition.
If you go back to the space where you created your HANA Cloud instance in the Cloud Platform Cockpit, you will notice that a new service of type hdi-shared has been created.
This can be binded to other applications and expose your HANA database for external use.
Note: this HDI container has been built, but it is not deployed yet. Right now it is just a development version used by the developer for testing. In order to expose your HDI containers for productive use, you must deploy them.
Share your code with other developers through Git
Your Web IDEworkspace is personal and cannot be shared with other developers. To share your code, we recommend using Git.
Right-click on your project and select Git>Initialize Local Repository.
A pop-up comes up and allows you to set your Remote repository.
Insert your repository URL.
Now, click on the Git icon on the right-side of the SAP Web IDE Full-stack. This will open the Git panel where you can use Git commands such as push, pull, rebase, merge.
Insert a commit message and push data to your central repository. The first time you push your code, you will need to log in, either through basic authentication or through a token.
A pop-up tells you when the push has been completed.
If you want to use SAP HANA Cloud with other clients, have a look at HANA Cloud : Connect clients.
The next step will be to use the routes and airports tables to create a graph.