SAP-samples / sap-tech-bytes

Accompanying the SAP Developer Advocates "SAP Tech Bytes" initiative.
Apache License 2.0
88 stars 36 forks source link

default-env.json -> VError: Could not parse default-env.json: Unexpected token � in JSON at position 0 #3

Closed draschke closed 3 years ago

draschke commented 3 years ago

Hello experts,

maybe one of you may help me. I try to follow your nice youtube video for local development without WebIDE, but struggling this time with the db default-env.json file. Get this error msg: VError: Could not parse default-env.json: Unexpected token � in JSON at position 0 I'm able to use the same file in an older different project and do not get this issue. Tried now this project with Node 10.x and Node 14.x but it fails with the same issue. Took the original default-env.json template from the hdi-deploy readme but there is no difference.

this is the beginning of my file: image

after reading the file by fs I can see the question marks at the beginning image

and throws an error, because of this question marks image

Would be nice if one of you has an idea to solve this issue. thanks for your advice!

jung-thomas commented 3 years ago

I don't see anything unusual in my default-env.json: image

I generally create my by cutting and pasting the service binding details from the cockpit or using the hana-cli serviceKey command https://github.com/SAP-samples/hana-developer-cli-tool-example#servicekey

If you are cutting and pasting from a readme file maybe you are inadvertently picking up some extra formatting or something.

draschke commented 3 years ago

Hi Thomas, thanks for your help. Does "hana-cli serviceKey" only work for CF? I use XSA.

PS C:\git\t3e\db> hana-cli serviceKey Input: CF/XS Service Instance Name: DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container Input: CF/XS Service Key Name: serviceKey-hdi-container Connection Problems: Error: Command failed: cf service-key DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container serviceKey-hdi-container

Wasn't sure with the Input Values. Maybe this is the reason for this error?

jung-thomas commented 3 years ago

Works with both but defaults to Cloud Foundry. Just use the -c option and set it to false when working with XSA. -c, --cf, --cmd Cloud Foundry? [boolean] [default: true]

draschke commented 3 years ago

Thanks, a lot! Creating the default-env.json file works as you said with -c false. But I could only create the default-env.json file in my already working project, but not in this project.

Now I run in this issue: hana-cli serviceKey -c false Input: CF/XS Service Instance Name: DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container Input: CF/XS Service Key Name: test5 SyntaxError: Unexpected end of JSON input at JSON.parse () at C:\Users\diraschk\AppData\Roaming\nvm\v14.8.0\node_modules\hana-cli\bin\connectViaServiceKey.js:99:34
at ChildProcess.exithandler (child_process.js:299:7) at ChildProcess.emit (events.js:314:20) at maybeClose (internal/child_process.js:1051:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) at Process.callbackTrampoline (internal/async_hooks.js:129:14)

Will close this issue. Thanks for your help!

draschke commented 3 years ago

Sorry, I missed the step to create a hdi-container before. Was stupid, tried always to connect with a wrong hdi-container.

Because I did this always by using the WebIDE, I want to do this also locally this time. So, now I came to your bookshop video and try to do this by myself.

But I run in this permission issue: PS C:\git\bookshop\db> hana-cli createContainer -a Input: Container Name: bookshop Using Connection Configuration loaded via ..\default-env-admin.json

Connection Problems: Error: insufficient privilege: Detailed info for this error can be found with guid '9C2AF86356F73742A12FCDFE90F93F92'

It seems, that the problem are missing privileges. Usually I'm able to do this with my user by using the WebIDE. Do I need different privileges? image

Thanks for your help!

draschke commented 3 years ago

ok, I think I found it. Developing with HANA Deployment Infrastructure (HDI) without XSA I guess I've to rethink the concept without XSA. :)

jung-thomas commented 3 years ago

Help me understand what's going wrong for you. You create the container with the xs create-service command. and then use the serviceKey command of the hana-cli to create the default-env.json.

If you want to create the container with the hana-cli createContainer you can do so. That command was designed for systems that don't have XSA or CF available and you want to use HDI via its Stored Procedure APIs only. You don't get a service instance, so this isn't good for when you want to bind a module to the container. Its good for HDI/DB only scenarios. However it should work as well but you need a very powerful user in the default-env-admin.json configuration. Something similar to the SYSTEM user but also has HDI admin privileges. Because technical user is going to act as the HDI broker and needs to have the authorizations to call the HDI stored procedures.

If you don't want to setup such an HDI admin user or you need to bind your HDI container to a service then you are better off using the xs create-service command to create the HDI container.

draschke commented 3 years ago

thanks for your clarification.

I still try to create the bookshop hdi-container without xsa. I was looking for this kind of code, to get the whole permissions for creating the hdi-container.

CREATE USER HDI_ADMIN PASSWORD xxx NO FORCE_FIRST_PASSWORD_CHANGE SET PARAMETER EMAIL ADDRESS = 'HDI_ADMIN@' ;
GRANT USER ADMIN to HDI_ADMIN;
CREATE LOCAL TEMPORARY TABLE #PRIVILEGES LIKE _SYS_DI.TT_API_PRIVILEGES;
INSERT INTO #PRIVILEGES (PRINCIPAL_NAME, PRIVILEGE_NAME, OBJECT_NAME) SELECT 'HDI_ADMIN', PRIVILEGE_NAME, OBJECT_NAME FROM _SYS_DI.T_DEFAULT_DI_ADMIN_PRIVILEGES;

CALL _SYS_DI.GRANT_CONTAINER_GROUP_API_PRIVILEGES('_SYS_DI', #PRIVILEGES, _SYS_DI.T_NO_PARAMETERS, ?, ?, ?);
DROP TABLE #PRIVILEGES;

But even after granting this permissions, I do get the error msg, that the admin role is missing. hana-cli createContainer -a

Connection Problems:  Error: insufficient privilege: "HDI_ADMIN"."(DO statement)": line 58 col 5 
(at pos 3482): Detailed info for this error can be found with guid '386EE723C11CC043B55E26BD928CCD27'

Yes, I can set this role by myself, but did I something wrong?

draschke commented 3 years ago

Is there a way to get a list of all XSA instances like for HANA Cloud?

hana-cli hdi hana-cli hc

jung-thomas commented 3 years ago

I was missing two role grants in the XSA environment when creating the HDI Admin users via adminHDI or adminHDIGroup commands. I've fixed that in the latest version (2.202105.3) which I just released to npm. https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/CHANGELOG.md#22021053

If you upgrade you should be good now. I tested in my local HANA Express instance.

First login as SYSTEM or similar super user: image

With that connection create an HDI Admin user: image

The credentials aren't saved locally by default, so connect again but this time with the new HDI Admin user you just created. image

Use the createContainer command with the -a switch to run the command as the HDI Admin user (stored in the default-env-admin.json file locally) image

When this command is complete it will write the container technical users into a default-env.json file (alongside the default-env.-admin.json) for local development. Most commands can now be issued without the -a switch but still have that option to run as the HDI Admin in special cases. But deploy and all other commands generally should run as the container technical users now. image

status command -a is running as HDITEST3 (the HDI Admin user we created) and status is running as the container technically user created when the container was created. image

jung-thomas commented 3 years ago

Is there a way to get a list of all XSA instances like for HANA Cloud?

All XSA instances - no. But you can get a list of all containers within the DB by using the command hana-cli containers image

The other commands you list I created only for the Cloud Foundry environment

draschke commented 3 years ago

after npm install -g hana-cli

Read once that only the owner of the npm can fix this problem. Not sure if is caused on my or on your side.

npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting ws@7.4.4:
npm ERR! Verification failed while extracting ws@7.4.4:
npm ERR! sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g== integrity checksum failed when using sha512: wanted sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g== but got sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==. (26972 bytes)
jung-thomas commented 3 years ago

How exactly are getting that error? When running npm locally? And for what - installing hana-cli? Or are you trying to npm install on the Tech Bytes project? ws isn't an SAP supplied or maintained module. But also I'm not having any problems installing it. image

draschke commented 3 years ago

Got it solved after running all this commands in this order. PS C:\git> npm uninstall -g hana-cli PS C:\git> npm cache verify PS C:\git> npm cache clean -f
PS C:\git> npm install -g hana-cli

draschke commented 3 years ago

Thanks a lot. Got it to work. Coud create a container locally without XSA. :)

There is still one question. Whats with spaces? Does them not relevant in the non-XSA world?

jung-thomas commented 3 years ago

Whats with spaces? Does them not relevant in the non-XSA world? In non-XSA or non-CF - no they aren't relevant. They were always a construct at the application level not really within the DB itself. If you want some measure of isolation within the HDI/DB world alone then consider HDI groups instead.

draschke commented 3 years ago

hana-cli status & hana-cli status -a --> works (everything looks good)

hana-cli hdbsql The hdbsql command is either misspelled or could not be found.

hana-cli: 2.202105.3 is there image

Did I something wrong?

jung-thomas commented 3 years ago

hdbsql is a separate tool https://github.com/SAP-samples/hana-developer-cli-tool-example#hdbsql Launch the hdbsql tool (if installed separately) using the locally persisted credentials default-env*.json

You can install it via the HANA Client installation from here: https://tools.hana.ondemand.com/#hanatools It does need to be added to your path so it can be called by the hana-cli tool. hana-cli just launches the tool and passes the connection information and authentication to it to save you a step.

draschke commented 3 years ago

hi Thomas, I need the name of the services instances for runnung hana-cli serviceKey, but hana-cli ups -c false for getting the services doesn't work for me.

PS C:\git\dr-sap-tech-bytes\db> hana-cli ups -c false Connection Problems: Error: Connection Problems: {"killed":false,"code":1,"signal":null,"cmd":"cf curl \"/v3/service_instances?space_guids=&organization_guids=&type=user-provided\"","stdout":"FEHLGESCHLAGEN\nKein API-Endpunkt festgelegt. Verwenden Sie 'cf login' oder 'cf api', um einen Endpunkt als Ziel auszuwählen.\n","stderr":""}

hana-cli serviceKey -c false Input: CF/XS Service Instance Name: ? Input: CF/XS Service Key Name: test

Thanks!

jung-thomas commented 3 years ago

hana-cli ups shows user provided services. HANA HDI would not be a User Provided Service but a normal service. You seem be getting the cf version of the API as well. Try --cf false and see if that works. But still the User Provided Service isn't the right option for this. You would instead use hana-cli hdi or you can of course always use cf services or xs services.

draschke commented 3 years ago

hana-cli serviceKey -cf false --> doesn't work Connection Problems: the same as above hana-cli hdi -c false --> doesn't work Connection Problems: the same as above hana-cli hdi -cf false --> doesn't work Connection Problems: the same as above hana-cli hdi -c false -a --> doesn't work Connection Problems: the same as above hana-cli hdi -cf false -a --> doesn't work Connection Problems: the same as above xs services --> I can only check for spaces? we do have 20 spaces. Don't think I would find it, because we didn't assign it.

jung-thomas commented 3 years ago

hana-cli serviceKey -cf false --> doesn't work Connection Problems: the same as above You get the same error as above? The /v3/ cf curl error? I don't see how that is possible as I don't even call that library/set of APIs in that command.

It's --cf not -cf for option in the hana-cli hdi comand

xs services doesn't work? I don't understand what you mean by you didn't assign it to a space.

draschke commented 3 years ago

PS C:\git\dr-sap-tech-bytes\db> hana-cli hdi --cf false
Connection Problems: Error: Connection Problems: {"killed":false,"code":1,"signal":null,"cmd":"cf curl \"/v3/service_instances?space_guids=&organization_guids=&service_plan_names=hdi-shared\"","stdout":"FEHLGESCHLAGEN\nKein API-Endpunkt festgelegt. Verwenden Sie 'cf login' oder 'cf api', um einen Endpunkt als Ziel auszuwählen.\n","stderr":""}

The /v3/ cf curl error? --> yes

xs services doesn't work? I don't understand what you mean by you didn't assign it to a space.

xs services --> works But if I create a hdi-container with hana-cli I do not assign the hdi-container to a space (because XSA is not relevant) How may I find them with xs? If we use xs service we need to go to a space at first. But spaces are not relevant in this case...

draschke commented 3 years ago

to get sure, the same (without false) PS C:\git\dr-sap-tech-bytes\db> hana-cli hdi --cf
Connection Problems: Error: Connection Problems: {"killed":false,"code":1,"signal":null,"cmd":"cf curl \"/v3/service_instances?space_guids=&organization_guids=&service_plan_names=hdi-shared\"","stdout":"FEHLGESCHLAGEN\nKein API-Endpunkt festgelegt. Verwenden Sie 'cf login' oder 'cf api', um einen Endpunkt als Ziel auszuwählen.\n","stderr":""}

jung-thomas commented 3 years ago

But if I create a hdi-container with hana-cli I do not assign the hdi-container to a space (because XSA is not relevant) How may I find them with xs?

I think I should clarify a few things here. When you create a container using the createContainer command of hana-cli, it is using the HANA Stored Procedure APIs of HDI to do so. In general the HDI Stored Procedures are an option that allows you to use HDI without any XSA or CF. For instance this is how ABAP creates and manages HDI container instances internally. This option of the hana-cli just makes it easier to call these Stored Procedures. However this option has no connection to XSA or CF. It doesn't create a service instance nor can XSA or CF service layer see or manage these HDI containers. They are DB only. But the upside is: they are DB only with no dependency on an App layer.

You have to manage the technical users and passwords for those technical users as you would any other technical user scenario in HANA. The HDI container life cycle and technical users are no longer manage by a service broker but instead you have direct control. This is why an HDI Admin and/or HDI Group Admin user(s) become more important.

But to summarize you can't combine this Stored Procedure HDI approach with XSA and CF. No xs or cf command is going to give you visibility or access to these HDI container instances.

Now to the error with the hana-cli hdi command. I've been unable to recreate the error. It works fine on my side. Perhaps run the command with the --debug option that will show me the internal processing of the Yargs and Prompts: image

The only issue I can think of is that you are not getting the latest version of the hana-cli tool. I only added the path for the xs support yesterday. What version of hana-cli are you using?

draschke commented 3 years ago

thanks for clarifying this! this helps me a lot!

PS C:\git\dr-sap-tech-bytes\db> hana-cli version
**hana-cli: 2.202105.3**
@sap/audit-logging: 5.0.0
@sap/cds: 5.1.1
@sap/cds-compiler: 2.2.4
@sap/cds-foss: 2.3.0
@sap/cds-runtime: 3.1.0
@sap/cds-dk: 4.1.1
@sap/cds-sidecar-client: 1.1.16
@sap/edm-converters: 1.0.41
@sap/eslint-plugin-cds: 1.1.2
@sap/hana-client: 2.8.20
@sap/hdbext: 7.2.0
@sap/e2e-trace: 3.0.0
@sap/textbundle: 4.0.0
@sap/xsenv: 3.1.0
@sap/xssec: 3.2.0
sap-hdbext-promisfied: 2.202105.1
hana-cli home: C:\Users\diraschk\AppData\Roaming\nvm\v14.8.0\node_modules\hana-cli\bin
https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/CHANGELOG.md

Compared with your values, I miss this value on my side hana-cli c: 'false',

PS C:\git\dr-sap-tech-bytes\db> hana-cli hdi --cf false --debug
  hana-cli Yargs values: +0ms
  hana-cli {
  hana-cli   _: [ 'hdi' ],
  hana-cli   cf: 'false',
  hana-cli   debug: true,
  hana-cli   Debug: true,
  hana-cli   disableVerbose: false,
  hana-cli   quiet: false,
  hana-cli   'disable-verbose': false,
  hana-cli   '$0': 'hana-cli'
  hana-cli } +2ms
  hana-cli Prompt values: +3ms
  hana-cli { disableVerbose: false, debug: true } +1ms
Connection Problems:  Error: Connection Problems:  {"killed":false,"code":1,"signal":null,"cmd":"cf curl \"/v3/service_instances?space_guids=&organization_guids=&service_plan_names=hdi-shared\"","stdout":"FEHLGESCHLAGEN\nKein API-Endpunkt festgelegt. Verwenden Sie 'cf login' oder 'cf api', um einen Endpunkt als Ziel auszuwählen.\n","stderr":""}
jung-thomas commented 3 years ago

Your version is 2.202105.3. But 2.202105.4 is the latest and the version where i introduced the new xs support for hdi and ups commands. https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/CHANGELOG.md#22021054

npm upgrade -g hana-cli should bring you up to the latest version.

draschke commented 3 years ago

yes it works. thanks!!!

Only wondering that I don't see the hdi services from the containers which I created yesterday. Is there a limit? Tried this, but didn't help. hana-cli hdi --cf false -l 300

SAP_TECH_BYTES                                           _SYS_DI               SAP_TECH_BYTES
                         HDI_ADMIN           2021-05-11 08:18:10.575000000
jung-thomas commented 3 years ago

Yes there is a limit and I didn't put a parameter in to control it. Do you have hundreds of container instances? I kind of assumed that space wouldn't have hundreds of instances, but if I'm off base then I'll have to add some control of the limit and maybe some pagination of the results for performance.

draschke commented 3 years ago

yes, round about 140 in our dev space. sorry! :)

jung-thomas commented 3 years ago

OK - I'll add a backlog item to add pagination. :)

draschke commented 3 years ago

Hi Thomas,

I'm struggling still with the serviceKey command. "SyntaxError: Unexpected end of JSON input" I tried it with an existing hdi-service more times an get always this issue.

PS C:\git\t3e\db> hana-cli serviceKey --cf false
Input: CF/XS Service Instance Name:  DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container
Input: CF/XS Service Key Name:  TESTQAY

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at C:\Users\diraschk\AppData\Roaming\nvm\v14.8.0\node_modules\hana-cli\bin\connectViaServiceKey.js:99:34
    at ChildProcess.exithandler (child_process.js:299:7)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1051:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
C:\Users\diraschk\AppData\Roaming\nvm\v14.8.0\node_modules\hana-cli\bin\cli.js:14
    global.__spinner.stop()
                     ^

TypeError: Cannot read property 'stop' of undefined
    at process.errorHandler (C:\Users\diraschk\AppData\Roaming\nvm\v14.8.0\node_modules\hana-cli\bin\cli.js:14:22)
    at process.emit (events.js:314:20)
    at process._fatalException (internal/process/execution.js:163:25)
stdout
'
Getting service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" ...

Service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" not found.

'

image

The hdi-container is there:

PS C:\git\t3e\db> xs service DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container
Service instance:   DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container
Service:            hana
Bound apps:        ..........., di-builder
Tags:
Broker tags:        hana, database, relational
Plan:               hdi-shared
Description:        HDI container on a HANA database
Created:            31.03.2021 14:45:28
Updated:            31.03.2021 14:45:31

I was able to create a service-key for my hdi-container with XS command xs create-service-key DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container HDIKEYDIRASCHK2 --> worked

Could it be that I need a different structured default-env-admin.json file for hdi-services which were created with WebIDE? Or is the structure for this admin file always the same? I'm asking because the structure generated via xs command looks different.

I use this:

{
    "VCAP_SERVICES": {
        "hana": [
            {
                "name": "hana-cli",
                "label": "hana",
                "tags": [
                    "hana",
                    "database",
                    "relational"
                ],
                "plan": "hdi-shared",
                "credentials": {
                    "password": "",
                    "port": "",
                    "encrypt": false,
                    "db_hosts": [
                        {
                            "port": "",
                            "host": "
                        }
                    ],
                    "host": "tbase-dev",
                    "user": "",
                    "sslTrustStore": "f",
                    "sslCryptoProvider": "openssl",
                    "sslValidateCertificate": true
                }
            }
        ]
    }
}

hana-cli status -a woks fine so far.

jung-thomas commented 3 years ago

This error is now complaining about the default-env-admin.json but actually the content coming out of the xs service command. The above content - did that all come from one command? Because at the beginning I see an input of service key TESTQAY

PS C:\git\t3e\db> hana-cli serviceKey --cf false Input: CF/XS Service Instance Name: DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container Input: CF/XS Service Key Name: TESTQAY

But later in the error I see a different service key of ASFSD:

Getting service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" ...

Service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" not found.

Does your service key exist before using the hana-cli serviceKey command? You need to use an existing service key in order to read the details. It isn't that the command creates a serviceKey.

draschke commented 3 years ago

You need to use an existing service key in order to read the details.

Was my misunderstanding, I thought it will create a hdi-service-key and a default-env.json file together.! Now it works! :)

create a default-env.json by using hana-cli serviceKey
=========================================================
PS C:\git\t3e\db> hana-cli serviceKey --cf false
Input: CF/XS Service Instance Name:  DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container
Input: CF/XS Service Key Name:  HDIKEYDIRASCHK2 (created with command xs create-service-key)
jung-thomas commented 3 years ago

I thought it will create a hdi-service-key and a default-env.json file together.!

I'm afraid not. In order to access the service credentials you need to know an existing service instance and key name. Without that I can't access the credentials. Although now that you mention it, I suppose I could make two calls - one to create a new key and then one to use that key to retrieve the credentials. I'd never thought about it that way before. I'll add that as a future enhancement request.

draschke commented 3 years ago

Hi @jung-thomas,

if I try to build my new generated views, I get this error msg:

PS C:\git\t3e\gen\db> npm start
    Error: The file requires "db://PATIENTVIEW" which is not provided by any file [8212001]
      at "src/gen/POService.PatientView.hdbview" (21:6-29)

I think the issue is that the word PATIENTVIEW is capitalized and I don't know why. If I try to set single or double quotes I run in other issues. Is there a restriction, so that we are only allowed to use capitalized views? I was looking to your sample and saw that there are all hdbviews capitalized.

image

jung-thomas commented 3 years ago

No HDBVIEW doesn't require all capital names, but I generally use them because I know that CAP does require all capitals. So although you are written PatientView in the CDS entity it will be converted to PATIENTVIEW going into the database. This is why you need hdbviews to covert the existing DB artifact naming to all caps to make CAP CDS happy. Now your hdbview should be able to support projecting over another DB object that doesn't have all caps, but you will need to put quotes around the name otherwise HANA also converts it to all upper case. You said that you tried quotes but ran into other issues? What were those? You'll definitely need to use quotes at the hdbview level if your target object has mixed case. For example here is an hdbview that runs on existing artifacts that have mixed case.
https://github.com/SAP-samples/hana-opensap-cloud-2020/blob/main/db/src/data/PurchaseOrder/PuchaseOrders.hdbview

draschke commented 3 years ago

Our hdbviews do have quotes. db\src\data\views\PatientView.hdbview image

image

jung-thomas commented 3 years ago

So if you put "PaientView" in the hdbview name like that then CAP CDS will NOT be able to use it. Although you use entity![PatientView] that entity will be translated to PATIENTVIEW when it tries to go to the underlying DB. Therefore you should name PatientView.hdbview as PATIENTVIEW.

jung-thomas commented 3 years ago

From the CAP help: https://cap.cloud.sap/docs/advanced/hana#make-the-object-known-to-cds

_Plain Names When using plain names, the database name is converted to uppercase and all dots are replaced by underscores. This conversion is the default behavior. If a database name is all in uppercase and is a regular SQL identifier, then it’s possible to construct a corresponding name in the CDS model that matches this name.

Quoted Names If the existing database name also contains lower-case characters or characters that can’t occur in regular SQL identifiers, it’s not possible to choose a name in the CDS model that matches this name. Let’s call such a database name “quoted”, as the only possibility to create such a name is to quote it in the CREATE statement.

In this case, it’s necessary to introduce an additional database object (a synonym or a view) on top of the existing database object and construct the facade entity for this newly introduced mapping object_