Managing Packages via the Command Line

You can use the datasphere command line interface to add required packages and objects to a package and to export the package to the Content Network.

Prerequisites

To create and export packages, you must have a combination of a global role and a scoped role:
  • A global role that grants you the following privileges:

    • Data Warehouse General (-R------) - To access SAP Datasphere.

    • Lifecycle (-R---MS-) - To use the Transport apps.

  • A scoped role that grants you access to a space with the following privileges:

    • Spaces (-RU-----) - To update your spaces and their properties.

    • Space Files (CRUD----) - To create, read, update, and delete objects in your spaces.

    • Data Warehouse Data Builder (-RU-----) - To view and update Data Builder objects (and any other relevant object privileges to allow you to update other types of objects contained in the package).

The DW Space Administrator global role and a scoped role based on the DW Space Administrator role template together grant these privileges. For more information, see Privileges and Permissions and Standard Roles Delivered with SAP Datasphere.
You must, in addition: To browse the available commands, enter the following and press Return:
datasphere objects packages

List, Read, Create, Update, and Delete Packages

Use the standard modeling object commands to work with packages:

Specify the Contents of a Package

A package must specify its required packages and the objects it contains, as well as Content Network metadata.

In the following example, My_Package has two required packages and contains three objects. When exported, it will create version 0.0.1 of the package:
{
  "repositoryPackages": {
    "My_Package": {
      "requires": [
        "Required_Package_1",
        "Required_Package_2"
      ],
      "_kind": "repositoryPackage",
      "_packageProperties": {
        "@EndUserText.label": "My Package",
        "purpose": "Demo Package",
        "contentDelivery": {
          "category": "myContent",
          "semantic_version": "0.0.1"
        }
      }
    }
  },"repositoryPackagesAttachedObjects": {
	"My_Package":[
            {
              "technicalName": "My_Table"
            },
            {
              "technicalName": "My_View"
            },
            {
              "technicalName": "My_Analytic_Model"
            },
	]
}
Complete your package definition as follows:
   

requires

Specify the list of technical names of any packages that contain objects that the objects you add to your package depend on as part of their lineage.

_kind

Must be set to repositoryPackage.

@EndUserText.label

Enter a descriptive name to help users identify the package.

purpose

Provide a business purpose for the package.

category

Must be set to myContent.

semantic_version

Enter the version number of the package in the format 1.0.0 (major version, minor version, patch number).

You can re-export your package with the same version number to overwrite the current exported version or change the version to export a package update. The version number must always go up and never down.

repositoryPackagesAttachedObjects

Specify the objects contained in the package as an array of JSON objects in the following format:

{
  "technicalName": "My_Table"
}
When your package definition is complete, use create (see Create Objects) or update (see Update Objects) to write it to your tenant.

Export Packages

You can export a package to the Content Network object and optionally write it to a file.

Enter the following command and press Return:
datasphere objects packages export 
    --space <id> 
    --technical-name <name>
    [--allow-overwrite]
Complete the parameters as follows:

Parameter

Description

--space <id>

Enter the Space ID of the space.

--technical-name <name>

Enter the Technical Name of the package.

--allow-overwrite

[optional] Use this option to specify that you want to overwrite the existing version of the package with the same semantic version number.

To create a new version of the package, specify a higher semantic version number.

If you do not specify this option and have not increased the semantic version number, then your export will fail.

For example, to export a new version of the package My_Package in space MySpace to the Content Network, enter:
datasphere objects packages export --space MySpace --technical-name My_Package