on ‎2023 Feb 17 10:21 AM
Hi ,
I am using CAP for build an application on HANA Cloud. I have used CSV file to do some testing. However, while deploying to production, i want to ignore those files?
Is it possible by some configuration (for example in Package.json)?
Regards,
nitin
Request clarification before answering.
The better solution might be to move the CSV files containing test data to the folder test/data.
cds watch is loading CSV files contained in the test folder by default while cds watch --production does not. Same holds true for production build and deployments, e.g. cds build --production, cds deploy --to hana --production.
Make sure that CSV files intended for testing aren't deployed to production by mistake as this would impact subsequent HANA deployments.
See also [providing initial data](https://cap.cloud.sap/docs/guides/databases#providing-initial-data).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
From SAP tutorial Deploy Your Multi-Target Application (MTA), specifically section Exclude CSV files from deployment:
You change the MTA build parameters to:
CSV files and the hdbtabledata) that is generated by the CAP server out of the CSV files.Add the following line to the mta.yaml file:
build-parameters:
before-all:
- builder: custom
commands:
- npm install --production
- npx -p @sap/cds-dk cds build --production
- npx rimraf gen/db/src/gen/dataRegards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello lothar.bender,
I'm not sure I see the inconsistency. In the link you provided, they talk about providing initial data, but they add a disclaimer:
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. To avoid such a situation, you can use the include_filter option that .hdbtabledata offers.
Whereas in the tutorial, the initial data is meant to be used while testing locally (sqlite or in-memory), and since they don't want the data in the .csv's to be loaded into Hana upon deploy as that initial data doesn't make sense in the production environment, or it's going to be changed by application users.
Regards.
Thanks for the hint. You are right, we should clearly distinguish the scenarios. When providing initial data for production, certain criteria must be fulfilled as HANA is assuming exclusive ownership of the predefined data. As the name implies, test data must not be deployed to production as this would impact further deployments.
I think the approach of using different CSV locations for both scenarios also fits better in this respect instead of deleting the CSV files later on as described in the tutorial.
I've already updated my initial answer. We will enhance the Capire documentation by a separate topic Providing Test Data. I will add the link once available.
Regards
Hi Nitin,
I don't know if our solution is the best one (wait for other answers before accepting this one 🙂 ), but we solve it by adding the following lines in the mta.yaml:

The first one applies to single-tenant applications, while the second one is required for multi-tenant applications.
Best regards,
Marc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.