I have created CAP project in which i was facing issue while deploying the db module
Error: com.sap.hana.di.view: Database error 260: invalid column name: TESTCALCVIEW1_0. Buyer: line 5 col 3
Came across this option
{"cdsc": { "sqlMapping": "quoted" }}
included it in package.json, the issue was resolved i was able to deploy the db module.
After this change the cds compiler generated view name for the calc view changed from
VIEW Service_Catalogue_testView AS SELECT<br> TESTCALCVIEW1_0.Buyer,<br> TESTCALCVIEW1_0.PONumber,<br> TESTCALCVIEW1_0.PODocDate,<br> TESTCALCVIEW1_0.POPlannedDlvDate,<br>FROM TESTCALCVIEW1 AS TESTCALCVIEW1_0to
VIEW "Service_Catalogue.testView" AS SELECT<br>"TESTCALCVIEW1_0"."Buyer",<br>"TESTCALCVIEW1_0"."PONumber",<br>"TESTCALCVIEW1_0"."PODocDate",<br>"TESTCALCVIEW1_0"."POPlannedDlvDate",<br>FROM "TESTCALCVIEW1" AS "TESTCALCVIEW1_0"
but the service is still using Service_Catalogue_testTable name and i am getting the following error
[cds] - GET /service-catalogue/testView <br>[cds] - [SqlError: invalid table name: <br>Could not find table/view SERVICE_CATALOGUE_TESTVIEW in schema 65BA998D32044055B20BC37D24B57EBB: line 1 col 584 (at pos 583)] <br>{<br> code: 259,<br> sqlState: 'HY000',<br> level: 1,<br> position: 583,<br> query: `SELECT Buyer AS "Buyer", PONumber AS "PONumber", <br> PODocDate AS "PODocDate", POPlannedDlvDate AS "POPlannedDlvDate", <br> FROM Service_Catalogue_testView ALIAS_1 ORDER BY Buyer ASC LIMIT 1000 OFFSET 0<br> with parameters ('LOCALE' = 'en')`,<br> id: '1271154',<br> timestamp: 1672236673835<br>}
Cds versions being used
@sap/cds : 6.4.0
@sap/cds-compiler : 3.5.2
@sap/cds-dk : 6.3.1
Package.json
{
"name": "BN_CalcView_POC",
"version": "1.0.0",
"description": "A simple CAP project.",
"repository": "<Add your repository here>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@sap/cds": "^6",
"express": "^4",
"hdb": "^0.19.0"
},
"devDependencies": {
"sqlite3": "^5.0.4"
},
"scripts": {
"build":"cds build/all --clean && cp hdi-deploy-env.json db/default-env.json && cp hdi-deploy-env.json gen/srv/default-env.json",
"start": "cds run"
},
"cds": {
"cdsc": { "sqlMapping": "quoted" },
"build": {
"tasks": [
{"for": "hana","dest": "../db"},
{"for": "node-cf"}
]
},
"requires": {
"db": {
"kind": "hana-cloud"
}
}
}
}
CAP_TEST_TABLE1.hdbtable
COLUMN TABLE "CAP_TEST_TABLE1" (
id INTEGER,
name VARCHAR
)
model.cds
@cds.persistence.exists
Entity CAP_TEST_TABLE1 {
ID: Integer @title: 'ID' ;
NAME: String(1) @title: 'NAME' ;
}
model-srv.cds
using {CAP_TEST_TABLE1} from '../db/model';
service Service_Catalogue {
@readonly
entity testTable as projection on CAP_TEST_TABLE1;
}
I followed the following steps to build and deploy DB artifact
Could anyone please let me know how to resolve this. Thanks in advance. [Attached the project structure ]
Regards,
Ramya