Managing Spaces via the Command Line
You can use the datasphere command line interface to list, read, create, update, and delete spaces.
Prerequisites
|
A global role that grants you the following privileges:
|
A scoped role that grants you access to a space with the following privileges:
|
-
Install the datasphere command line interface (see Install or Update the SAP Datasphere Command Line Interface).
-
Log in to your SAP Datasphere tenant (see Log into the Command Line Interface via an OAuth Client).
datasphere spacesFor general information about working with spaces, see Creating Spaces and Allocating Resources and Managing Your Space.
List Spaces
To list the spaces available to you on the tenant, enter the following command and press Return:
datasphere spaces list
[--host "<url>"]
[--output <file>.json]
|
Parameter |
Description |
|---|---|
|
--host "<url>" |
Enter the URL of your SAP Datasphere tenant. You can copy the URL of any page in your tenant. Alternatively, set a host value (see Set a Host Value to Identify Your SAP Datasphere Tenant). |
|
--output <file>.json |
[optional] Enter a path to a .json file to write the output to. If you do not include this option, the output will be printed to the command line. |
Read a Space
To read a space definition to the console or to a file, enter the following command and press Return:
datasphere spaces read
--space <id>
[--definitions [<obj1>,<obj2>]]
[--no-space-definition]
[--output <file>.json]
Complete the parameters as follows:
|
Parameter |
Description |
|---|---|
|
--space <id> |
Enter the Space ID of the space. |
|
--definitions [<obj1>,<obj2>] |
[Optional] Read the object definitions contained in the space. You can use the --definitions parameter by itself to read all the objects, or specify a comma-separated list of object technical names.
Object definitions are read using the standard CSN syntax (see Core Data Services Schema Notation (CSN)
). The following objects can be read (exported):
|
|
--no-space-definition |
[Optional] Suppress the display of the spaceDefinition property. When used with the --definitions option, this allows you to read object definitions without seeing the other properties of the space. |
|
--output <file>.json |
[optional] Enter a path to a .json file to write the output to. If you do not include this option, the output will be printed to the command line. |
Create or Update a Space
datasphere spaces create
--file-path <file>
Complete the parameters as follows:
|
Parameter |
Description |
|---|---|
|
--file-path <file>.json |
Enter a path to a file with a .json extension containing your space definition. |
|
--force-definition-deployment |
[Optional] Deploy changes to objects even if they will generate validation messages warning of impacts to objects that depend on them. Using this option is equivalent to clicking the Deploy Anyway button in the Validation Messages dialog (see Modifying Objects That Have Dependent Objects). |
|
--enforce-database-user-deletion |
[Optional] Allow the deletion of database users and their associated Open SQL schemas, when the dbusers section is present in the space definition file. If any existing database user is not included in the dbusers section and this option is omitted, then they will not be deleted in order to protect against unintended data loss. |
|
--input '<stringified-json>' |
[Optional] Provide your space definition in stringified json format instead of via the --file-path option. For example: --input '{"MY_SPACE":{"spaceDefinition":{"version":"1.0.4"}}}'
|
Delete a Space
datasphere spaces delete
--space <id>
[--force]
Complete the parameters as follows:
|
Parameter |
Description |
|---|---|
|
--space <id> |
Enter the Space ID of the space. |
|
--force |
Delete the space without confirmation. If you do not include this option you will be prompted to confirm the deletion. |
