Hi there!
Question about the Docs
We are currently using .net core v3.0, and our application in CSEO uses the Gremlin API to push data to CosmosDB. The Azure documentation for BulkUpdate. In the purple box at the top of the page of this documentation, it says that these operations only apply to SQL API. However, in the "about Azure bulk executor" page, the documentation says it applies to SQL API and Gremlin API. Is there a difference here? Since we are using the Bulk Executor for the Gremlin API, will there be unexpected behaviors?
Here is the inconsistency we saw using these operations for the Gremlin API to push data to Cosmos:
Observed Behavior:
The documentation states that SetUpdateOperation should update key-value properties for all Cosmos documents, regardless of edge or vertex. However, in our application, we are experiencing that this operation is instead _deleting key-value properties_, and not updating them, for vertices only. We are receiving a status code response from the bulk executor with a successful update, so there are no exceptions or errors occurring. We are calling it exactly the same way as the code that the BulkUpdate documentation provides.
Expected Behavior: The documentation states that SetUpdateOperation should update key-value properties for all Cosmos documents, regardless of edge or vertex.
Let me know if there's anything else I can provide. Any clarity on my confusion would be greatly appreciated, thanks so much!
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@lumichael24 Thanks for the question! We are investigating and will update you shortly.
@lumichael24 BulkExcutor .NET library is available for both Azure Cosmos DB SQL as well as gremlin API.
The documentation provided by you is very specific to SQL API. If we are using it for gremlin API it might behave differently.
I would suggest you to use below method which is very specific to graph API for bulk updates:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.graph.graphbulkexecutor.bulkupdateasync?view=azure-dotnet
Hi @AnuragSharma-MSFT - Thanks for the response! Just to be clear, since the two methods from the documentation I provided and the one you provided look the same, is the only difference the object that we should call the method upon? For example, I need to initialize a GraphBulkExecutor, and then call the method on this instance with the same parameters?
Does that seem correct? thanks so much for the help!
@lumichael24 Yes instead of initializing BulkExecutor we will initialize GraphBulkExecutor, and then call BulkUpdateAsync on it.
I myself have not tried writing that code but I checked BulkUpdateAsync method is available on GraphBulkExecutor and it should work.
Please let me know if you still face any issue and we can take it accordingly.
Hi @AnuragSharma-MSFT thank you! I will try this tomorrow and do some testing and will follow up below when I have an update. I appreciate the help!
Hi @AnuragSharma-MSFT. I tried calling this method on GraphBulkExecutor and get this error:
[2020-12-03T17:36:08.963Z] WUS2-dev BulkUpdateAsync: Exception: System.NotImplementedException: The method or operation is not implemented.
[2020-12-03T17:36:08.964Z] at Microsoft.Azure.CosmosDB.BulkExecutor.Graph.GraphBulkExecutor.BulkUpdateAsync(IEnumerable`1 updateItems, Nullable`1 maxConcurrencyPerPartitionKeyRange, Nullable`1 maxInMemorySortingBatchSize, CancellationToken cancellationToken)
The package version we are using is <PackageReference Include="Microsoft.Azure.CosmosDB.BulkExecutor" Version="2.4.1-preview" />. I have also tried this for all the versions of 2.*, and v.1.8.9 is not backwards compatible with the DocumentClient. If we look at the BulkExecutor package, it looks like SQL api is supported for BulkUpdate. However, in the link you sent, the package is also looks like it should work for Graph API since it is a GraphBulkExecutor instance. Is the GraphBulkExecutor you listed in a different package, or is there anything else we can try?
@lumichael24 Apologies for the trouble you are facing. I have reached out to product team on the same and will be updating the thread as soon as I hear back from them.
@tknandu We have raised this question though Cosmos Internal discussion email as well. Please check if you can provide some info here as well.
@lumichael24, Update & Delete is not implemented for Gremlin API.
Hi @manishmsfte. Thanks for the response. That's weird because BulkDelete worked for me for Gremlin API. Are there any alternatives we can use in the meantime? Or is there a plan to implement update and delete for Gremlin API soon?
For update: Please use BulkImportAsync refer https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmosdb.bulkexecutor.graph.graphbulkexecutor.bulkimportasync?view=azure-dotnet with enableUpsert=true.
For delete: Please use BulkExecutor directly instead of GraphBulkExecutor.
Hope this helps!
@manishmsfte Thanks for the help.
@lumichael24 We will now proceed to close this thread. If there are further questions regarding this matter, please comment and we will gladly continue the discussion.