This guide is about defining, providing, implementing, deploying, and publishing services — so about Service Providers in general.
Get an overview of your deployment options, which will be explained in the following section.
The fastest way to let your application run is using a local SQLite database via the npm module sqlite3, which is a devDependency of your project. Using the command line
cds deploy --to sqlite helps you deploy the database parts of the project to a local SQLite database. It
- Creates an SQLite database file in your project.
- Drops existing tables and views, and re-creates them according the CDS model.
- Deploys CSV files with initial data.
Turning into a production-near mode, you can use SAP HANA Cloud in your project. There are two ways to include SAP HANA in your setup: Use SAP HANA in a hybrid mode, meaning running your services locally and connect to your database in the cloud, or running your whole application on SAP Business Technology Platform. This is possible either in trial accounts or in productive accounts. To make the following configuration steps work, we assume that you’ve provisioned, set up, and started, for example, your SAP HANA Cloud instance in the trial environment. If you need to prepare your SAP HANA first, see How to Get an SAP HANA Cloud Instance for SAP Business Technology Platform, Cloud Foundry environment to learn about your options.
Enhance Project Configuration for SAP HANA Cloud
To prepare the project, execute:
cds add hana
This configures deployment for SAP HANA to use the
hdbviewformats. The default format of
hdbcdsis not available on SAP HANA Cloud.
No further configuration is necessary.
For your information, this is what the previous command has changed in
@sap/hana-clientdriver for SAP HANA is added as a dependency. Note that in the future, this might change to
hdb, which is a leaner driver. See section SAP Support for hdb and @sap/hana-client for a feature comparison.
- A datasource of type
sqlis added in the
cds.requires.dbblock. See section Node.js configuration for more details.
See tutorial Use SAP HANA as the Database for a CAP Java Application for the rest of the configuration.
cds deploy --to hana lets you deploy just the database parts of the project to an SAP HANA instance. The server application (the Node.js or Java part) still runs locally and connects to the remote database instance, allowing for fast development roundtrips.
Make sure that you’re logged in to Cloud Foundry. Then in the project root folder, just execute:
cds deploy --to hana
Behind the scenes,
cds deploy --to hana does the following:
- Compiles the CDS model to SAP HANA files (usually in
- Generates hdbtabledata files for the CSV files in the project. If an
hdbtabledatafile is already present next to the CSV files, no new file is generated.
- Creates a Cloud Foundry service of type
hdi-shared, which creates an HDI container. Also, you can explicitly specify the name like so:
cds deploy --to hana:<myService>.
@sap/hdi-deploylocally. Should you need a tunnel to access the database, you can specify its address with
default-env.jsonin the project root. With this information
runcan connect to the HDI container at runtime using the production profile (
If you run into issues, see the Troubleshooting guide.
cf deploy or
See the Deploying to Cloud Foundry guide for how to deploy the complete application to SAP BTP.
Providing Initial Data
CSV files in your project are picked up by deployments for both SQLite and SAP HANA. The following conventions apply:
- The files must be located in folders
- They contain data for one entity each. File names must follow the pattern
<namespace>-<entity>.csv, for example,
- They must start with a header line that lists the needed element names.
On SAP HANA, only use CSV files for configuration data that can’t be changed by application users. CSV files are deployed as hdbtabledata, which assumes exclusive ownership of the data. It’s overwritten with the next application deployment.
If you have accidentally deployed such data to a productive database, see this troubleshooting entry for how to recover from this situation.