Going beyond! Using synonyms to access data external to your HDI container
One of the most desired features in native SAP HANA development is to achieve true isolation between applications that run (or are developed) in the same SAP HANA landscape. With SAP HANA XS Advanced Model the use of organizations, spaces and HDI containers (rather than classic” database schemas) makes this not only possible but actually very easy.
However isolation does have a price should your scenario involve accessing data that’s not stored within the HDI container of your application.
Imagine that you need to access data that’s already stored in a “classic” SAP HANA database schema – perhaps being managed by or having originated in some other application like S/4, ERP or BW?
Or you have data in an HDI container generated by your XS Advanced application but how can other “classic” applications access it via a traditional database schema?
Or how can you access data that’s stored in the HDI container of a different XS Advanced application – perhaps that of another developer during the development phase?
These are all great questions!
The answers involve creating and granting roles along with the use of database synonyms so that tables & views can appear as if they’re part of your application even if they’re physically stored elsewhere in SAP HANA.
Christoph Gilde already published an excellent series of blogs that cover how to do this.
At the SAP HANA Academy we love to produce hands-on video tutorials – so inspired by Christoph’s great work – we’ve published a series of new video tutorials that show you how to answer the above questions step by step.
Here’s an Introduction
Accessing data from a “classic” database schema:
- Create roles
- Create user-provisioned service
- Create grants
- Create synonyms
- Create calc view and OData service
Accessing HDI container data from a “classic” schema:
Accessing a different:
Code snippets are provided in GitHub so you can easily follow along.
As always your feedback is most welcome – below, in the YouTube comments section, or on Twitter @pmugglestone.
Excellent blog! Thank you for sharing. Does this process still apply for HANA 2.0 SP03?
Hi, Thanks for reading and your question. Yes indeed this should work fine with HANA 2.0 SPS03.Philip
Thank you Philip.
Since its has been 2 years you published this blog. I was wondering if there was better way to link the tables from different schema to the HDI container . I believe we will have to work continue to with Synonyms .
Indeed, synonyms are still the way to go.
You were great and everyone received so much from your experience and knowledge
Absolutely amazing, thank you for sharing your knowledge with me.