cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Clone HDI container on BTP

carlonnheim
Participant
1,651

Hi,

Is there a way to create a new HDI container instance as a copy of an existing one on BTP? This would be very useful for development purposes; we can have one main container which integrates data from other systems etc. and each developer can clone from that to do their work independently from other developers while still having access to good test data?

Thanks

//Carl

Accepted Solutions (1)

Accepted Solutions (1)

azamat_leverx
Explorer

Hi Carl,

I tried different ways to duplicate an HDI container and finally found one.

  1. Create an empty HDI container from BTP Cockpit with a unique name.
  2. Go to Database Explorer and create a database connection with the SYSTEM user.
  3. Right click on the connection and press "Export HDI Container"
  4. Select the HDI container which you want to duplicate and press "Prepare HDI Container for Download"
  5. Wait until the status is "SUCCESS" and press the little glass icon

  6. Copy the name of the temporary export table (from browser dev tools)

  7. Open SQL Console and run this command and wait a while:
  8. CALL _SYS_DI.IMPORT_CONTAINER_FOR_COPY
    ('C2', CURRENT_SCHEMA, 'EXPORT_TABLE_NAME', _SYS_DI.T_NO_PARAMETERS, ?, ?, ?); 
  9. Delete the Export table by clicking the little trash icon.

Note "C2" that is the name of your new container, and "EXPORT_TABLE_NAME" is the name of your Staging Table.

If you do not specify the schema name while creating your HDI container in parameters JSON, you have to look up a generated name from the credentials.

This was the only way that didn't break "@sap/hdi-deploy" deploy, because it also imports C2#DI HDI schema with database artifacts objects.

carlonnheim
Participant

Looks really promising, many thanks for sharing!

Answers (1)

Answers (1)

Jarrod-Beltramo
Explorer
0 Kudos

Hey Carl,

Another solution to your problem may be the creation of a CSV file for sharing between the developers/development teams, that models the data that is in the original HDI container. A developer tutorial posted by Thomas Jung called Create Database Artifacts Using Core Data Services for SAP HANA Cloud. In step five he shows a way to upload CSV files. if you look in the screenshot there is the same functionality for exporting data 🙂

Tutorial: Create Database Artifacts Using Core Data Services (CDS) for SAP HANA Cloud

This also gives some other flexibility to your development cycle. For example developers can use the CSV when creating a CAP application to model there data using a SQLite db before deploying to a HDI container for test. This saves on compute resources as a developer would not have to deploy a HDI container, that would run constantly in development. This would allow your company to decrease its development cost during the development phase of the application lifecycle management process.

for more information on this you can review the Cookbook on Using Databases in the Cloud Application Programing guide.

Documentation: Cookbook - Using Databases

carlonnheim
Participant
0 Kudos

Thanks Jarrod,

Much appreciated and yes this works in many cases. Our setup is however continuously sourcing data from external systems. The data volume is not huge but moving fast. I am looking for a way where a developer can clone the active development database thus getting a snapshot of good test data without everyone needing the to run the integrations and data ingestions.

csv export/import would be a challenge due to the number of tables involved. We could construct tooling based on something like the answer here:

https://answers.sap.com/questions/13029637/looking-for-import-and-export-the-csv-file-hana-20.html

But I would think the use case is quite frequent (also relevant to e.g. do deployment dry runs on production copies etc.) hence hoping there would be some ready-made tooling?

Thanks!

//Carl