When updating existing csv, we are getting 400 error.
please provide project info, a sample file for reproducing and error messages.
Id | Name |
---|---|
1 | Ram1 |
2 | Shyam |
3 | Sundar |
4 | Bandar |
5 | Kiran |
Imported above records via csv
Then name has been updated against ID.
Id | Name |
---|---|
1 | Ram |
2 | Shyam Singh |
400 Bad Request
It is giving error {“msg”:“insert into "nc_aplo___Book2_csv" ("Id", "Name") values ($1, $2), ($3, $4), ($5, $6), ($7, $8), ($9, $10) returning "Id" - duplicate key value violates unique constraint "nc_aplo___Book2_csv_pkey"”}
Ideally it should update record against primary key
Please share your project info.
didn’t get. We are using latest noco and deploy on local and testing, when above error occurs
See here.
Node: v18.0.0
Arch: x64
Platform: linux
Docker: false
Database: pg
ProjectOnRootDB: true
RootDB: pg
PackageVersion: 0.98.4
Issue with router.patch(
‘/api/v1/db/data/bulk/:orgs/:projectName/:tableName’,
apiMetrics,
ncMetaAclMw(bulkDataUpdate, ‘bulkDataUpdate’)
);
patch is not executing…Manually have called method and seems working fine…
Also in patch it should insert data if in sheet new data is there.
0.98.4 is not the latest version. Can you try on the latest one (0.100.2) to see if the issue is still reproducible?
ok, updating, and trying
Node: v18.0.0
Arch: x64
Platform: linux
Docker: false
RootDB: sqlite3
PackageVersion: 0.100.2
In Above build same issue
Okay. I misunderstood the issue. It seems you are importing a CSV to a new table and import another one to the same table. The error you received is expected as the import is to insert the records to the target table. It won’t patch the data with the given key.
Yes, correct, But there is a patch method, which updates the data. (Which i run manually and it work).
Here, expected behavior, it should update record as per primary key and if no matching record found as per primary key, then it should insert new record.
Yes. That PATCH method hasn’t integrated into import module yet. Will be supported in the future.