cancel
Showing results for 
Search instead for 
Did you mean: 

CDS deploy - Error when loading data from .csv

HenrikD
Participant
0 Kudos

I'm trying to load data from a .csv, but keep getting an error (Segmentation fault: 11).

Any Solution?

Below is the terminal output and content of cds and csv.

/> successfully deployed database to ./db/test-example.db
> filling Testing from db/csv/Testing.csv
Segmentation fault: 11
test.cds

entity Testing {
    key userId : String(10);
    name : String(20);
    }
Testing.csv

userId;name
"0000000001";"Willy the whale"
"0000000002";"Donald duck"
cds version:
@sap/cds: 3.13.0
@sap/cds-compiler: 1.15.0
@sap/cds-ql: 1.14.0
@sap/cds-hana: 1.13.0
@sap/cds-sql: 1.13.0
@sap/cds-sqlite: 1.13.0
@sap/cds-reflect: 2.5.0
@sap/cds-services: 1.14.0
@sap/odata-server: 1.3.4
@sap/odata-commons: 2.1.1
@sap/generator-cds: 2.4.11
qmacro
Developer Advocate
Developer Advocate

What is the output of

sqlite3 db/test-example.db .dump

?

Accepted Solutions (1)

Accepted Solutions (1)

pierre_dominique2
Contributor

Hi,

As Gregor mentioned, the csv files should use the following naming convention:

<namespace>-<entity>.csv so in your case Test.cds-Testing.csv

However the dot might be an issue, you should try to rename your namespace to just Test or even better, pick some meaningful names. 😉

Cheers,

Pierre

pierre_dominique2
Contributor

Ok forget about my comment, I need a coffee. Test.cds is the filename, not the namespace. 🙂

I just did a quick test but I can't reproduce the issue:

PS C:\Users\pdominique\Code\cap\test> cat .\db\test.cds
entity Testing {
    key userId : String(10);
    name : String(20);
}
PS C:\Users\pdominique\Code\cap\test> cat .\db\csv\Testing.csv
userId;name
"0000000001";"Willy the whale"
"0000000002";"Donald duck"
PS C:\Users\pdominique\Code\cap\test> cds deploy --to sqlite:db/test.db
 > filling Testing from db\csv\Testing.csv
 > updated package.json
/> successfully deployed database to ./db/test.db
PS C:\Users\pdominique\Code\cap\test> cds v
@sap/cds: 3.13.0
@sap/cds-compiler: 1.15.0
@sap/cds-ql: 1.14.0
@sap/cds-hana: 1.13.0
@sap/cds-sql: 1.13.0
@sap/cds-sqlite: 1.13.0
@sap/cds-reflect: 2.5.0
@sap/cds-services: 1.14.0
@sap/odata-server: 1.3.4
@sap/odata-commons: 2.1.1
@sap/generator-cds: 2.4.11
CDS home: C:\Users\pdominique\Code\cap\test\node_modules\@sap\cds

Answers (3)

Answers (3)

qmacro
Developer Advocate
Developer Advocate

Not a solution yet, but just to double check I have all the pieces - I am trying to reproduce the issue, but not having much success

Perhaps you could share your test project, e.g. in a Gist / on GitHub?

The one thing that strikes me as odd is that the order of the messages in the "deploy" output is the "wrong way round", i.e. "successfully deployed ..." comes last, usually.

FWIW, I've seen a segfault error before, but can't remember the circumstances.

HenrikD
Participant

HI,

I have found the solution 🙂

When i created a new project, copied the files and did a build. It was worked!

Regards,

Henrik

gregorw
Active Contributor

Have you tried renaming your .csv file to test-cds-Testing.csv to match the namespace?

HenrikD
Participant
0 Kudos

Hi Gregor,

It's actually one of the mysteries and could be the answer 🙂

It seems that there is some confusion using '-', '.' or '_'. I have seen different kind of notation (ie. com.sap.sapmentors.sitregcapm-EventTypes.csv from sitregcapm) and tried different kind with no success.

Do you know the secret? Should '-' always be used and not '.' and '_'?

And what does 'Segmentation fault:11' mean?

Have you found the documentation 🙂

p244500
Active Contributor
0 Kudos

Hi,

Follow the bellow link.

Importing Data from CSV file

gregorw
Active Contributor

This video has nothing to do with the CDS way to import CSV.