Azure-Samples / azure-cosmosdb-graph-bulkexecutor-dotnet-getting-started

.NET sample of Bulk Executor Utility for Azure Cosmos DB Gremlin API
21 stars 15 forks source link

How to insert/upsert Vertex Meta Properties #3

Open JJ11teen opened 6 years ago

JJ11teen commented 6 years ago

The GremlinVertexProperty class seems to have methods for accessing existing meta properties but not creating/assigning them. Can someone please point to the correct method to accomplish this?

preshi commented 5 years ago

Hi. I also require this feature. Were you able to accomplish this.

JJ11teen commented 5 years ago

Unfortunately not, I ended up sort of writing my own version of this library (and unfortunately it was commercial so I can't share it). It was basically a thin wrapper which took in JSON in the form returned by the Cosmos SQL API and added some helper functions and typed out some known properties for gremlin graphson objects. There was a lot of backwards engineering using the Cosmos query explorer in the portal (insert with gremlin then query with SQL to see what form it takes). It turns out I didn't need a lot of the more advanced configurations around concurrency and sorting memory.

preshi commented 5 years ago

@JJ11teen : I see a GUID is mapped to id of each property doc Eg:[Prop1.id=4475269e-78d2-4708-9737-7142044658da"] in below sample JSON Doc. If you have created custom bulk insertor,may i know is it just at random you are generating this id or any rationale/logic is followed in generating it.

{ "label": "company", "Prop1": [ { "_value": "1", "id": "4475269e-78d2-4708-9737-7142044658da" } ], "Prop2": [ { "_value": "Tata Sons", "id": "04592b58-b445-4fd3-8133-c781c525e68e" } ], "id": "e23c4fcc-d401-4ad2-90ea-d4386e9b038d", "_rid": "pZVBAIP3p1gBAAAAAAAAAA==", "_self": "dbs/pZVBAA==/colls/pZVBAIP3p1g=/docs/pZVBAIP3p1gBAAAAAAAAAA==/", "_etag": "\"c6005dcf-0000-0300-0000-5c8f66160000\"", "_attachments": "attachments/", "_ts": 1552901654 }

JJ11teen commented 5 years ago

I just used a random/new guid. (Guid.NewGuid())

preshi commented 5 years ago

Any performance implication in Read/Write RUs observed because you switch between API [SQL & Gremlin] for Read and Writes.

JJ11teen commented 5 years ago

I found the bulk SQL to be much more performant, as well as being able to handle retrying partial requests (meaning large queries were more likely to eventually go through, rather than failing outright).

I also can't say I noticed any degraded performance on the Gremlin side after using my bulk method if that's what you mean, but I have been struggling with Gremlin performance from the onset (Gremlin performance was the reason for doing bulk SQL insertion initially). There were some performance improvements announced for the Gremlin parser a while ago but I haven't been on the project since then.