0

Azure Cosmos Gremlins API.

Assume Partition key - division

Germline query to add node

g.addV('person').
  property('firstName','Thomas').
  property('lastName', 'Andersen').
  property('age', 44)

How I will insert similar JSON data into cosmos from cosmos gremlin API or from python code .Please check address has multiple row .

persondata = {
    firstName: 'Thomas',
    lastName: 'Andersen',
    age: 44,
    Address: [
        {"id": 1, "city": "city1", "comment": "something useful, I'm sure"},
        {"id": 2, "city": "city2", "comment": "wisdom from the interwebs"},
        {"id": 3, "city": "city3", "comment": "....."}
    ]

};

g.addV('person', persondata );

similar article available - http://5.9.10.113/59629769/how-to-insert-data-as-json-object-with-gremlin-api-in-azure-cosmos-db

In other words is it possible to ingest direct JSON data into gremlin API ( SQL API - possible)

e.g:

{
    "id": "AndersenFamily",
    "lastName": "Andersen",
    "pKey": "Andersen",
  } 

below link for SQL APT - JSON https://learn.microsoft.com/en-us/azure/cosmos-db/sql-query-working-with-json

Jack
  • 21
  • 1
  • 5
  • Thanks Kelvin for nice format – Jack Jun 25 '21 at 17:52
  • For easy solution , can we insert json data directly to gremlin . – Jack Jul 01 '21 at 04:22
  • I'm not sure what features various databases may offer but Gremlin does not have any way to shred a JSON document into properties or anything like that. The best you can do is store an entire JSON document as a string using just Gremlin steps. – Kelvin Lawrence Jul 01 '21 at 15:59
  • Kelvin , Thanks for response . The workaround looks good but afraid that will may not fast search for huge data size as it will not treat as property . For each property I have to parse json file ( means single property ) . But I like your idea . – Jack Jul 07 '21 at 15:57

0 Answers0