1
 Follower
5
 Likes

Aggregates and Advanced SQL query with resultset as unstructured data/dictionary

Aggregates & Queries
New

Hello Everyone,

Currently, the Aggregates and advanced queries require that we define a output structure/indicate entities to save the result set of the database query.

It would be great if: it was also allowed to return unstructured resultset (list of objects) and we would simply use the untyped objects to display the results. A developer could just access the specific fields from the result set by a key-value kind of programming model.

Example: ResultItem['name'] to access the name or ResultItem['age'] to access the age column. Here ResultItem has a datattype of 'Object'. Alternatively, it could also be a 'Dictionary'.  

Practical usage in real projects:

1. Consider a multitenant application which creates 'Proposals'. Every Proposal has some mandatory attributes while others are optional and tenant specific. Example: Proposals created by tenantA may require additional attributes like 'Notes'. But the 'Notes' attribute may not be applicable for tenantB.

2. In database we can maintain all the attributes. If a particular attribute does not apply for a tenant, it will be NULL.

3. Now, when we query for the Proposal attributes in context of a tenant, we would like to fetch only the attributes applicable for that tenant. So - we cannot determine the output structure for our query output in advance. And since there can be lot many tenants, it is not possible to create a specific structure/entity for every tenant.

Hence the need for the above idea.  There can be many more uses of the above "unstructured" result set.  

We could have these new "unstructured " aggregates and advanced sql queries along the existing aggregates and advanced sql queries.


Created on 19 Oct 2018
Comments (1)

Changed the category to Aggregates & Queries


views
176
Followers
1