cancel
Showing results for 
Search instead for 
Did you mean: 

CSV file, ignore while deploying to production

NitinMahajan
Product and Topic Expert
Product and Topic Expert
1,875

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

View Entire Topic
lothar_bender
Product and Topic Expert
Product and Topic Expert

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

Anton_Mavrin
Product and Topic Expert
Product and Topic Expert
0 Kudos

Sounds like a great solution 🙂

AlessandroSpadoni
Contributor
0 Kudos

Hi Lothar,

in my opinion this is the best approach to have a local environment with data with no risk to deploying csv in production,

I didn't find anything in cap.cloud.sap , do you know how to find additional documentation about it? by the way I already tried and it works like a charm

Thanks

lothar_bender
Product and Topic Expert
Product and Topic Expert
0 Kudos
This approach isn't documented yet, but we will integrate it as part of some other changes related to the "handling initial test data topic"
dmalav
Associate
Associate
0 Kudos

I apologise for multiple comments, happened due to a misunderstanding

dmalav
Associate
Associate
0 Kudos
Hi Lothar, I am also trying to do this, and came across your comment here. The csv files in test/data do not load for me when I run the application locally. To be more precise: I created this test/data folder at the same level as the db folder. I am confused as to what I am missing, even after going through the documentation. Could you help me understand what I could be missing?
dmalav
Associate
Associate
0 Kudos
Hi Nithin, I am also trying to do this, and came across your comment here. I see that you were able to make this work! For me, the csv files in test/data do not load when I run the application locally. To be more precise: I created this test/data folder at the same level as the db folder. I am confused as to what I am missing, even after going through the documentation. Could you help me understand what I could be missing?
lothar_bender
Product and Topic Expert
Product and Topic Expert
0 Kudos
Are you using cds watch?
lothar_bender
Product and Topic Expert
Product and Topic Expert
0 Kudos
The filenames are expected to match fully qualified names of respective entity definitions in your CDS models, optionally using a dash - instead of a dot . for cosmetic reasons.