cancel
Showing results for 
Search instead for 
Did you mean: 

Support public synonyms in CAP ( support service with empty namespace )

pepl
Active Participant
0 Kudos

Hi!

Let me please describe my use case. I would like to serve the following cds:

@cds.persistence.exists
entity ![VIEWS] {
    SCHEMA_NAME : String;
    VIEW_NAME  : String
}<br>

For that purpose I need to have a service like that:

service public {    
    entity VIEWS ...
}<br>

The problem here - this kind of service will expect to have a synonym like public.TABLES in the user schema, but what I want - is just to select from VIEWS/TABLES and other public Hana synonyms without the namespace.

Therefore what my suggestion is - allow us to define an anonymous service:

service {    
    entity VIEWS ...
}

an alternative solution, along with path we may allow to redefine the namespace:

@namespace: ''
service public {    
    entity VIEWS ...
}

So as a result I expect CDS to generate select from VIEWS, and also to support nested association joins. So namespace public. must be in use with a special directive.

What do you think of this proposal? Do you think is feasible?

Which benefits we may reach:

- by use of public synonyms we may build service which won't need any deployment

- it will create space for numerous utilities on tob of standard tables ( for example CDS generators )

Thank you!

View Entire Topic
gregorw
Active Contributor
0 Kudos

Hi Petr,

I had had the same challenge now and tried different variants. Based on what I saw as the generated SQL in the SAP HANA Database Explorer where FROM "PUBLIC"."TABLE_COLUMNS" is used:

I've tried this variants without success:

a) Synonym on the Public Synonym:

Error: com.sap.hana.di.synonym: Database error 7: feature not supported: cannot create synonym for synonym: line 1 col 52 (at pos 51) [8201003] at "src/tableColumns.hdbsynonym" (0:0)

b) View doing a select on the Public Synonym:

Error: com.sap.hana.di.view: "PUBLIC"."TABLE_COLUMNS": the reference has to be schema-local in "VIEW" "PUBLIC_TABLE_COLUMNS" [8250002] at "src/PUBLIC_TABLE_COLUMNS.hdbview" (16:6-30)

But finaly I solved it with a Synonyms to SYS. Check this commit:

tableColumns.hdbsynonym

Best Regards
Gregor