Skip to Content

HANA DB in the cloud: Deployment of HDI container drops all the tables created at run-time

Recently we moved our development to the Cloud.

Our MTA application uses HANA DB service in the cloud and creates DB tables at run-time (using CREATE TABLE statement). We also use HDI container to define and deploy DB artifacts to the cloud.

And we experience the following:

Each time we deploy our HDI it drops all the tables created by the app during run-time. All tables defined in the HDI remain intact.

Before cloud we used on-premise HANA XSA installation and there were no such effect: all tables (defined in HDI or created at runtime) remained intact after each deployment.

Is it a bug or a feature?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jun 18, 2020 at 03:59 PM

    With the help of SAP support we have found the workaround for this. But first, this is the explanation of the root cause:

    1. The deployment process for HDI container is designed so that every time you deploy the container artifacts within HDB module the deployment task creates a new technical user for the container and deletes the last technical user (created for the previous deployment)
    2. Normally you use this technical user to communicate with HANA DB artifacts and when you execute some DDL statement (e.g. CREATE TABLE) then the owner of the created object would be the technical user of the container
    3. Next deployment process will delete existing technical user and all the object this user owns.

    So, to overcome this for dynamically created tables we change the ownership immediately after creation with ALTER TABLE ... OWNER TO = <user name>. We use a special user which owns all the container objects created at deployment phase: <schema_name>#OO

    Apparently there should be a table with ownership information of objects as it looks like changing ownership with DDL option is available only for tables.

    Another workaround can be using stored procedures for object creation, just don't forget to add

    SQL SECURITY DEFINER

    to the procedure definition. In this case objects created by such a procedure will be created under container object owner.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 16, 2020 at 12:34 PM

    Hi Sergey

    Did you find solution to this? We are also facing the same issue but not able to find any solution for this.

    Many thanks,

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Jigar,

      Yes, we found a workaround, please see the answer. So, for tables you can change ownership with ALTER TABLE DDL statement and for other kinds of objects you should use stored procedures for object creation and don't forget to add SQL SECURITY DEFINER option to that procedure.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.