Managing Connections via the Command Line

You can use the datasphere command line interface to read, list, validate, create, edit, and delete connections.

Prerequisites

To work with connections on the command line, you must have a scoped role that grants you access to a space with the following privileges:
  • Data Warehouse General (-R------) - To access SAP Datasphere.

  • Data Warehouse Connection (CRUD----) - To create, edit, validate, or delete a connection.

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

The DW Space Administrator and DW Integrator role templates, for example, grant these privileges. For more information, see Privileges and Permissions and Standard Roles Delivered with SAP Datasphere.
To specify another location ID than the default location when using Cloud Connector for your connection, you must have a role that grants the following privilege:
  • Connection (-R------)

If you need to select a location ID, ask your tenant administrator to assign your user to a global role (with license type SAP Datasphere) that includes the Connection.Read privilege. 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 spaces connections 

For information about working with connections in SAP Datasphere, see Integrating Data via Connections.

Connection Types Supported for Creating and Editing Connections

Creating and editing connections via the command line is supported for the following connection types:

Connection Type

Type ID in the Command Line

More Information

Amazon Athena

ATHENA

Amazon Athena (Connection Definition File Format)

Amazon Redshift

REDSHIFT

Amazon Redshift (Connection Definition File Format)

Amazon Simple Storage Service

S3

Amazon Simple Storage Service (Connection Definition File Format)

Apache Kafka

KAFKA

Apache Kafka (Connection Definition File Format)

Cloud Data Integration

CDI

Cloud Data Integration (Connection Definition File Format)

Confluent

CONFLUENT

Confluent (Connection Definition File Format)

Generic JDBC

GENERICJDBC

Generic JDBC (Connection Definition File Format)

Generic OData

ODATA

Generic OData (Connection Definition File Format)

Generic SFTP

SFTP

Generic SFTP (Connection Definition File Format)

Google BigQuery

BIGQUERY

Google BigQuery (Connection Definition File Format)

Google Cloud Storage

GCS

Google Cloud Storage (Connection Definition File Format)

Hadoop Distributed File System

HDFS

Hadoop Distributed File System (Connection Definition File Format)

Microsoft Azure Blob Storage

WASB

Microsoft Azure Blob Storage (Connection Definition File Format)

Microsoft Azure Data Lake Store Gen2

ADL

Microsoft Azure Data Lake Store Gen2 (Connection Definition File Format)

Microsoft Azure SQL Database

AZURESQL

Microsoft Azure SQL Database (Connection Definition File Format)

Microsoft SQL Server

MSSQL

Microsoft SQL Server (Connection Definition File Format)

Oracle

ORACLEDB

Oracle (Connection Definition File Format)

SAP ABAP

ABAP

SAP ABAP (Connection Definition File Format)

SAP BW

SAPBW

SAP BW (Connection Definition File Format)

SAP BW∕4HANA Model Transfer

SAPBWMODELTRANSFER

SAP BW∕4HANA Model Transfer (Connection Definition File Format)

SAP ECC

SAPECC

SAP ECC (Connection Definition File Format)

SAP HANA

HANA

SAP HANA (Connection Definition File Format)

SAP HANA Cloud, Data Lake Files

HDL_FILES

SAP HANA Cloud, Data Lake Files (Connection Definition File Format)

SAP HANA Cloud, Data Lake Relational Engine

HDLDB

SAP HANA Cloud, Data Lake Relational Engine (Connection Definition File Format)

SAP SuccessFactors

SAPSF

SAP SuccessFactors (Connection Definition File Format)

SAP S/4HANA Cloud

SAPS4HANACLOUD

SAP S/4HANA Cloud (Connection Definition File Format)

SAP S/4HANA On-Premise

SAPS4HANAOP

SAP S/4HANA On-Premise (Connection Definition File Format)

List Connections in a Space

You can list all the connections in a space and optionally write the output to a file.

Enter the following command and press Return:
datasphere spaces connections list 
				--space <space>
				[--accept <accept>]
				[--details]
				[--name]
				[--features ]
				[--top <n>]
				[--skip <n>]
				[--output file.json]
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--accept <accept>

[optional] Specify the format to return the connections definition in. You can choose between:

  • "application/vnd.sap.datasphere.space.connections.list+json" - [default]

  • "application/vnd.sap.datasphere.space.connections.details+json"

--details

[optional] List the connections with all their details except for credentials.

--name

[optional] List only the connections' technical names.

--features

[optional] List the connections with their technical names and their information about enabled and disabled features.

--top <n>

[optional] List only the first <n> connections (according to their creation date), up to a maximum of 200.

Default: 10

--skip <n>

[optional] Skip the first <n> connections.

Default: 0

--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.

For example, to list all the connections in space MySpace showing their technical and business names as well as their type id, creation date, creator, and replication status and write them to a file, enter:
datasphere spaces connections list --space MySpace --output MySpaceConnections.json

Read Connection Details

You can read the JSON definition of a connection (without its credentials) in a space and optionally write the output to a file.

Enter the following command and press Return:
datasphere spaces connections get 
    --space <space>
    --name <name>
	[--output file.json]
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--name <name>

[optional] Enter the technical name of the connection.

--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.

For example, to read the definition of the connection MyConnection in space MySpace write it to the default file name, enter:
datasphere spaces connections list --space MySpace --name MyConnection --output MySpaceConnections.json

Create Connections

You can create a connection in a space by providing a definition in a JSON file or an input string. For an overview of supported connection types and information about the required file format, see Connection Types Supported for Creating and Editing Connections.

Enter the following command and press Return:
datasphere spaces connections create 
    --space <space>
    --type-id <connection type id>
    --file-path<path> | --input <input>
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--type-id <connection type id>

Enter the connection type id (see Connection Types Supported for Creating and Editing Connections).

--file-path<path>

[optional] Enter a path to a file with a .json extension containing your connection definition.

--input <input>

[optional] Provide your connection definition in stringified json format instead of via the --file-path option.

For example, to create the SAP SuccessFactors connection MyConnection in space MySpace, enter:
datasphere spaces connections create --space MySpace --type-id SAPSF --file-path MySFConnectionDefinition.json

Validate Connections

You can validate a connection in a space.

Enter the following command and press Return:
datasphere spaces connections validate 
    --space <space>
    --name <name>
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--name <name>

Enter the technical name of the connection.

For example, to validate the connection MyConnection in space MySpace, enter:
datasphere spaces connections validate --space MySpace --name MyConnection

Edit Connections

You can edit a connection in a space by providing a new definition in a JSON file or an input string. For an overview of supported connection types and information about the required file format, see Connection Types Supported for Creating and Editing Connections.

Enter the following command and press Return:
datasphere spaces connections edit 
    --space <space>
    --name <name>
    --file-path<path> | --input <input>
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--name <name>

Enter the technical name of the connection.

--file-path<path>

[optional] Enter a path to a file with a .json extension containing your connection definition.

--input <input>

[optional] Provide your connection definition in stringified json format instead of via the --file-path option.

For example, to edit the SAP SuccessFactors connection MyConnection in space MySpace, enter:
datasphere spaces connections edit --space MySpace --name MySFConnection --file-path MySFConnectionDefinition.json

Delete Connections

You can delete a connection in a space.

Enter the following command and press Return:
datasphere spaces connections delete 
    --space <space>
    --name <name>
	[--force]
Complete the parameters as follows:

Parameter

Description

--space <space>

Enter the Space ID of the space.

--name <name>

Enter the technical name of the connection.

--force

[optional] Suppress the Confirm Deletion dialog and delete the connection without confirmation.

For example, to delete the connection MyConnection in space MySpace and suppress the Confirm Deletion dialog, enter:
datasphere spaces connections delete --space MySpace --name MyConnection --force