Table of Contents |
---|
Issues/Questions and Decisions
Issue/Question | Decision | Notes |
---|---|---|
What is the proposed approach to be used in CPS? Do we use the approach as per postgREST where the REST queries are executed directly as database queries without the need of any ORM? | As per an exchange on Slack, we are not going with the postgREST model. And instead stick to using the cps-ri layer as it is? https://onapproject.slack.com/archives/C03UJAZAV3K/p1711714427478109 | |
The proposal says the search parameter will look something like this, ?select=name, price.gt.100. But in the postgREST documentation we can see that entities like name and price are considered columns in a data base while in this proposal these are mentioned as leaf data node. | ||
postgREST implements operators that are translated to SQL queries, for example "eq" translated to =. How do we implement these operators in our approach? | ||
How to handle parsing of requests. And multiple search requests. | ||
Need to define Structure of data being returned, just returning a leaf can be confusing as leaves with same name can exist under different data nodes | ||
Need grammar to handle the search equation and different kinds of data types in the search, for instance Strings, Arrays and Integers in a query. These can be sent individually in a request or maybe combined in same request as well. |
Objective
CPS query API can be further improved to support more generic query parameters or request parameters where we can provide request input like json JSON and that will be parsed to SQL query. these parameters are optional and provides more generic approach to query from large data.
...
API: GET http://<IP>:<PORT>/cps/v2/dataspaces/{dataspace-name}/anchor/{anchor-name}/nodes/query?select={generic_query_parameter}
Query
...
parameters.
Parameter Name | Objective | Examples |
---|---|---|
select | To query only selected fields for a given cps-path. | ?select=title, price ?select=name, price.gt.100 |
Use cases.
- We want to query data nodes and get only selected few leaves. It will help to limit the output data and also in searching if a leaf in present in a data node or not.
- Search of a specific leaf without knowing actual cps-path. If a client is not sure about the cps-path but he wants to query for a given leaf node