Describing SAP HANA Deployment Infrastructure

Objective

After completing this lesson, you will be able to describe SAP HANA Deployment Infrastructure.

SAP HANA Deployment Infrastructure

SAP HANA Deployment Infrastructure (HDI) is a set of services specific to XS Advanced that allows the independent deployment of database objects. It relies on HDI containers.

HDI containers are a special type of database schema that manage their contained database objects.

These objects are described in the HDB modules of XS Advanced projects, in design-time artifacts that are deployed by the HDI Deployer application. HDI takes care of dependency management and determines the order of activation. HDI also provides support for upgrading existing runtime artifacts when their corresponding design-time artifacts are modified.

One key concept of HDI containers is the fact that the entire lifecycle (creation, modification, and deletion) of database objects is performed exclusively by the HDI. Therefore, you cannot create database artifacts, such as tables or views, with Data Definition Language (DDL) statements in SQL.

Indeed, if you create a table in a container schema with a plain SQL statement, this means that there is no design-time object for this table. So, upon deployment of the container, this table will not be recreated.

Note

This is very different from other types of applications that use different persistence frameworks that rely on plain schemas. These frameworks can directly execute DDL statements.

Key Properties of HDI Containers

  • A container is equivalent to a database schema.

  • Database objects are deployed into the schema.

  • Definitions must be written in a schema-free way: the name of the container schema is determined only when deploying the container.

  • Direct references to external schema objects are not allowed: these objects must be referenced using database synonyms created within the container.

Note

You will learn more about synonyms later on in this unit.

HDI Container Configuration File

Within each HDB module of a project, you will find a very important and mandatory file that exists under the src folder with the suffix: .hdiconfig. This is the HDI container configuration file that is used to bind the design-time files of your project to the corresponding installed build plug-in.

Code block showing the contents of the HDI Container configuration file.

Without the build plug-in, it is not possible to build the run-time objects from the design-time files. This configuration file directs each source file in your project to the correct build plug-in.

Note

The .hdiconfig file is hidden by default in the Web IDE, so you may need to first expose the file (choose the button that looks like an ‘eye’ above the source files tree to show the hidden files).

Usually, there is only one .hdiconfig file in a HDB module, and this must be located in the root folder of the HDB module. This file contains a list of all bindings for all source file types. However, it is also possible to create additional .hdiconfig files lower down in the project folder hierarchy which would then expand or restrict the definitions at a certain point in the hierarchy. Because the configuration files are specific to each project, this means you could work on multiple projects in the Web IDE, each using different versions of the same build plug-ins. This could be useful when working on the next phases of development for an application that requires the latest build plug-ins, but at the same time needs to support older versions of the application which require the older build plug-ins.

Inside the container configuration file you will find, for each source file type, three entries:

  • suffix name, for example, "hdbcalculationview"

  • plug-in name, for example, "com.sap.hana.di.calculationview"

  • plug-in version, for example, "2.0.40.0"

The version number definition is optional, but it is a good idea to include this so that you are sure to be binding the correct version of the plug-in to the source files in your project. You can have multiple versions of the same build plug-in installed in your landscape and the plug-ins are often updated with each SAP HANA release to handle the new features. For plug-ins that share the same version number, you can specify the version number once at the start of the file and not for each suffix. Then, only specify the version number against the suffixes that do not follow the global version number defined at the top of the file.

It’s very important to remember that when you import a project into your landscape, it brings its own .hdiconfig file that refers to the plug-ins versions that were used when it was first developed. If you then plan to update the source file using newer features of SAP HANA (for example, you want to add a new feature to a calculation view that just became available with the newer version of SAP HANA), you will not see the new feature in the source editor if the .hdiconfig file has not been adjusted to use the later version of the build plug-ins. In other words, just because you install the new build plug-ins, it does not mean that it is automatically used for all projects. Always check the .hdiconfig file each time to be sure. For new projects where the .hdiconfig file is first created, the latest plug-in version will be referenced in the configuration file.

Caution

The HDI container configuration file is an unnamed file and must only consist of the suffix .hdiconfig. If you try to add a name, the build of the .hdiconfig file will fail. Leave it as it is.

The Database Explorer

Inside the SAP Web IDE for SAP HANA, you can use the Database Explorer perspective to view the database artifacts (tables, views, procedures, column views) of one or several containers that you add to the list.

When you do this, access to the container is given by a technical user that is created transparently when you add the container to the Database Explorer. This occurs even if you are logged on to the SAP Web IDE with your usual SAP Web IDE user. This technical user interacts with the database objects on your behalf, for example, to view the contents of a table or preview the data of a calculation view.

Note

Until SAP HANA 2.0 SPS02, the HDI container technical users’ names had an SBSS_ prefix.

As of 2.0 SPS03, to enhance readability, the technical user’s name starts with the corresponding schema name (container). For example, HA300_01_HDI_HDB_1_5TODRJKQCIJYG7T2H9076YFG6_RT.

If your container consumes data from an external schema, the technical user must also be granted authorizations to the external schema objects, for example, to view the data of an external table referenced by a synonym.

Note

The Database Explorer also allows you to connect to classic database schemas (not managed by the SAP HANA Deployment Infrastructure) to show the database objects and the content of tables, to execute queries in a SQL console, and so on.