13
© Copyright IBM Corporation, 2018 Page 1 of 10 24 July 2022 Accessing Object from external HDI Container of XS Advanced application in HANA 2.0 Applies to: This article applies to the method or approach off accessing object from external HDI container of XS Advanced applications in HANA 2.0 Summary: This document aims at providing a brief reference about how to access objects or HANA artifacts from another HDI container of XS Advanced(XSA) applications. HDI (HANA Deployment Infrastructure) is a service layer of the SAP HANA database that simplifies the deployment of HANA database artifacts by providing a declarative approach for defining database objects and ensuring a consistent deployment into the database. SAP HANA HDI container consists of a design-time container and a corresponding run-time container. Database schema abstracted by HDI container and should only be accessed via container. In HDI container only local objects can be accessed and foreign objects can only be accessed by synonyms. This article would provide reference about how to access such objects from the external HDI container of XSA applications. This will enable integration between projects developed by microservices based architecture. Author: Dipanshu Roy Created on: 9 th September 2018 Email id: [email protected]

WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

© Copyright IBM Corporation, 2018 Page 1 of 10 18 May 2023

Accessing Object from external HDI Container of XS Advanced application in HANA 2.0

Applies to: This article applies to the method or approach off accessing object from external HDI container of XS Advanced applications in HANA 2.0

Summary: This document aims at providing a brief reference about how to access objects or HANA artifacts from another HDI container of XS Advanced(XSA) applications. HDI (HANA Deployment Infrastructure) is a service layer of the SAP HANA database that simplifies the deployment of HANA database artifacts by providing a declarative approach for defining database objects and ensuring a consistent deployment into the database. SAP HANA HDI container consists of a design-time container and a corresponding run-time container. Database schema abstracted by HDI container and should only be accessed via container. In HDI container only local objects can be accessed and foreign objects can only be accessed by synonyms. This article would provide reference about how to access such objects from the external HDI container of XSA applications. This will enable integration between projects developed by microservices based architecture.

Author: Dipanshu RoyCreated on: 9th September 2018Email id: [email protected]

Page 2: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

TABLE OF CONTENTS

BUSINESS REQUIREMENT..................................................................................................................................................................3

OVERVIEW...............................................................................................................................................................................................3

PROCESS & TOOLS USED;...................................................................................................................................................................3

SOLUTION:...............................................................................................................................................................................................3

CONCLUSION:.......................................................................................................................................................................................12

REFERENCE:.........................................................................................................................................................................................12

© Copyright IBM Corporation, 2018 Page 2 of 10 18 May 2023

Page 3: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

BUSINESS REQUIREMENT

There would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project to build applications parallelly, faster and agile way. However, any real-world project would also require integration between applications and accessing or sharing objects between applications. The database artifacts in HDI containers are local objects and not visible to different project and HDI container in it. The database artifacts which are foreign objects to HDI container, however can be accessed by synonyms. The views can consume the local synonym provide access to the data resides in different HDI container, thus allow integration between applications.

OVERVIEW

Accessing objects and artifacts in another HDI container from XSA application requires synonyms to be created in the HDI container. One needs to follow below steps.

1. Create target HDI container as source via adding external SAP HANA services.2. Create roles in target HDI container.3. Provide privilege to object owner and application user to the roles created4. Create synonym for the external HDI container object.5. Creating view to consume the synonym created for external HDI container object

PROCESS & TOOLS USED;

HANA 2.0 sp03 is used for this demonstration. Basic knowledge of database concept and skills are required. One should be familiar with eclipse-based tools or the HANA Web Ide as currently SAP only supports WEB Ide for developing XSA applications.

One should be familiar with basic concept of Unix commands, HANA application based security, user role, SQL and HANA modeling techniques.

SOLUTION:

The following is the demonstration of how to achieve integration between applications created in different XS Advanced projects. The integration here demonstrated by accessing HANA table created in one HDI container from another HDI container by using synonym. The users of the container have been granted privilege which is applications based introduced in XS Advanced applications.

© Copyright IBM Corporation, 2018 Page 3 of 10 18 May 2023

Page 4: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

Create target HDI container as source via adding external SAP HANA services:

One need to add external SAP HANA service for consuming HDI container (projext-hdi_extdb) for the target HDI container (projdroy-hdi_droydb)

© Copyright IBM Corporation, 2018 Page 4 of 10 18 May 2023

Page 5: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

The following external service entry has been added to the project descriptor file mta.yaml

A demo CDS table has been created in the target HDI container(projdroy-hdi_droydb) which would be consumed from external HDI container (projext-hdi_extdb)

The table has been populated with some sample records.

Create roles in target HDI container: Any HDI container has two technical owners

a) Application owner© Copyright IBM Corporation, 2018 Page 5 of 10 18 May 2023

Page 6: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

b) Object owner

I have created following two roles for synonym access. The roles would be used by HDI container object owner to access table from target HDI container. Two different roles have been created to prevent unwanted schema access via the view as SAP recommends assigning different roles to the object owner and the application user.

© Copyright IBM Corporation, 2018 Page 6 of 10 18 May 2023

Page 7: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

Provide privilege to object owner and application user to the roles created:

The owner of the HDI container containing the synonym requires SELECT privilege on target HDI container object which is CDS table here.

Creating Synonym for the DEMO_TABLE1 table in target HDI container(projdroy-hdi_droydb)The synonym DEMO_TABLE_SYN can be created through extcon.hdbsynonym file created in extdb database module.We need to choose external services so the external HDI container and the table (DEMO_TABLE1) would be visible for creating the synonym.

© Copyright IBM Corporation, 2018 Page 7 of 10 18 May 2023

Page 8: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

The created synonym in database explorer pointing to external schema and the corresponding table.

© Copyright IBM Corporation, 2018 Page 8 of 10 18 May 2023

Page 9: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

Creating View to consume external HDI container table via the synonym:

The view EXTCONT_VIEW has been created to consume the synonym pointing to DEMO_TABLE1 table in external HDI container.

© Copyright IBM Corporation, 2018 Page 9 of 10 18 May 2023

Page 10: WELCOME TO · Web viewThere would be a requirement HANA 2.0 XSA application to access HANA objects or artifacts from one HDI container to another HDI container. This would allow project

The data preview in data explorer perspective of the view created based on synonym.

CONCLUSION:The above approach is valid till HANA 2.0 SP03 for XS Advanced applications. The approach would benefit developers accessing external HDI container objects for seamless integration between XS advanced applications. The approach would benefit developers to integrate XS advanced application created through microservices methodology or more conventional agile methodology.

REFERENCE:

SAP HANA Developer Guide for XS Advanced Model

https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/1547c14105be409ebfc3a9e9634a7188.html

© Copyright IBM Corporation, 2018 Page 10 of 10 18 May 2023