Forum Discussion
richie
Community Hero
Hey ameesh1984,
i had a quick look at a GET (SELECT query) and it appears very simple....i.e. you can do a simple SELECT with basic filters and you can do INNER JOINS (didnt see any aggregate functions) but that appears to be the limit of what the REST API supports so looks a little disappointing.
HOWEVER, I need to highlight that i dont know how data is stored in a NoSQL database. Perhaps due to how the data is stored referentially etc. more complex queries arent necessary to do what you need?
I do appreciate that if youre hitting a cloud hosted database, typically the host doesnt allow its customers direct queryable access via JDBC like you would have for an on premise instance.
I always try and put my SQL together in a single complex query rather than multiple sequential queries (cos i like stretching my mind a bit and its more efficient), but theres nothing wrong in having multiple queries instead of a single complex query. Perhaps this is the approach you should use id you need to put a complex query together?
Sorry i cant be more help!
Rich
i had a quick look at a GET (SELECT query) and it appears very simple....i.e. you can do a simple SELECT with basic filters and you can do INNER JOINS (didnt see any aggregate functions) but that appears to be the limit of what the REST API supports so looks a little disappointing.
HOWEVER, I need to highlight that i dont know how data is stored in a NoSQL database. Perhaps due to how the data is stored referentially etc. more complex queries arent necessary to do what you need?
I do appreciate that if youre hitting a cloud hosted database, typically the host doesnt allow its customers direct queryable access via JDBC like you would have for an on premise instance.
I always try and put my SQL together in a single complex query rather than multiple sequential queries (cos i like stretching my mind a bit and its more efficient), but theres nothing wrong in having multiple queries instead of a single complex query. Perhaps this is the approach you should use id you need to put a complex query together?
Sorry i cant be more help!
Rich
ameesh1984
4 years agoContributor
Azure Cosmos DB REST API Reference | Microsoft Docs https://docs.microsoft.com/en-us/rest/api/cosmos-db/?WT.mc_id=email
This looks like it supports all crud operations and many more for cosmos
This looks like it supports all crud operations and many more for cosmos
- richie4 years agoCommunity HeroHey ameesh1984
Oh yeah it does...you can SELECT, INSERT, UPDATE and DELETE straightforward enough via the relevant http methods that are supported.
All im saying is that you are limited in the level of complexity for the queries you can execute. For example. If you wanted to join two tables but the referential columns in the tables had different datatypes you wouldnt be able to CAST to convert the one column to an appropriate datatype. Im using this example because it was one of the things i tried to do when i was querying a cloud based DB via REST. Another example. I couldnt update the data in one table based on the contents of the other table in others cos when you do this in SQL you need to use a subquery to do it and this wasnt supported.
It simply depends on the complexity and functions youd need to execute im guessing. If the equivalent SQL queries are reasonably basic then the REST API does the job. If what youre testing requires complex queries it wont.
Can you describe briefly what you need to test? Are you publishing messages to a webservice that updates the cosmos database. If you were testing something like this then basic queries will probably suffice. If you are testing a system where the quality of the test data is a concern then perhaps basic queries wont suffice. This is what ive found in my experience of doing this.
Cheers
Rich- ameesh19844 years agoContributorWe are testing web services and the responses of those we will compare with the cosmos db data we fetch via rest api mentioned
- richie4 years agoCommunity HeroHey ameesh1984,
In that case you should be able to do what you need.
Youll just perform the methods that your webservice supports (to create, update and delete records) and then follow up with a simple GET to the db API to verify the records were created, updated and deleted appropriately. At most im guessing youll need to JOIN but that is supported so it sounds like you have all your boxes ticked.
Nice one,
Rich
Related Content
Recent Discussions
- 14 hours agoruchisingh