question

xiaoliangyang-1295 avatar image
0 Votes"
xiaoliangyang-1295 asked AnuragSharma-MSFT commented

Cosmos Gremlin Query Execution Error

     Gremlin Query Execution Error: Cannot add a vertex where the partition key property has value 'null'.

with git clone https://github.com/Azure-Samples/azure-cosmos-db-graph-python-getting-started.git

azure-cosmos-db
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

error also in Gremlin console

0 Votes 0 ·

Hi @xiaoliangyang-1295, please let us know if you need more details on this. if answer helped, you can mark it 'Accept Answer'.

0 Votes 0 ·

1 Answer

AnuragSharma-MSFT avatar image
0 Votes"
AnuragSharma-MSFT answered

Hi @xiaoliangyang-1295, welcome to Microsoft Q&A forum.

This error indicates that the partition key is not consistent between the cosmos account and python code.

If we look at the code, we have partition key mentioned as 'pk':

     "g.addV('person').property('id', 'thomas').property('firstName', 'Thomas').property('age', 44).property('pk', 'pk')",

Now when we create a new database and graph in Azure Cosmos DB, please mention the partition key as pk as mentioned in below screenshot (Yellow highlighted section):

105293-image.png

I was able to run the same code successfully by changing the db,coll and password only.

Please let me know if this works or else we can discuss further.


if answer helps, please mark it 'Accept Answer'





image.png (121.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.