Azure Cosmos DB Gremlin
  • 01 Apr 2022
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Azure Cosmos DB Gremlin

  • Dark
    Light
  • PDF

Article summary

Azure Cosmos DB Gremlin

Cerebrata makes managing the data stored in your Cosmos DB Gremlin API accounts relatively painless. From managing databases, graph to vertices and edges, Cerebrata provides the most extensive set of features.
Loaded with features like executing multiple queries, built-in query manager, stored procedures, functions and triggers and more, Cerebrata is essentially your one-stop shop for managing your Gremlin account.

Add Cosmos DB Gremlin via Access Keys

User can add a Cosmos DB Gremlin into the Cerebrata using access keys also.

  1. User can click on the New Cosmos DB Account Connection option aligned with cosmos Db accounts.

Associate Cosmos DB accounts.png

  1. Now user can choose Gremlin(Graph) option and provide the required credentials and click on save.
    The assigned Cosmos DB Gremlin account can now be managed with Cerebrata.

Properties

Note

Properties of Cosmos Gremlin DB can be accessed in Cerebrata only when you associate Cosmos DB SQL via Subscription Connection.

To view the properties of the Comos Gremlin

  1. User can traverse to the path - All resources > Azure Subscription > Required Subscription > Comos DB Accounts > Required Cosmos Gremlin account
  2. Now user has to click on Manage icon aligned with the Cosmos Gremlin account name

Manage Properties.png

For Azure Cosmos Gremlin, user can view properties like

  • Cosmos DB name
  • Account API
  • Resource ID
  • Resource Group name
  • Resource Group ID
  • Subscription name
  • Subscription ID
  • Location
  • URI
  • Gremlin Endpoint
  • Provisioning State
  • Offer Type
  • Default Consistency
  • Multi Region Write Enabled

User can also open the appropriate Azure resource in the Azure portal without traversing between the browser and the application, using the Open in portal option available at the top right corner.

In the manage tab user can also view/edit the following options

  • Tags
  • Management Locks
  • Access keys
  • Geo Replication
  • Default Consistency

CRUD Operations in Azure Cosmos Gremlin

CRUD operations from Cerebrata Cerebrata provide a better GUI and make the user experience more smooth.

Create

Create Database

New database can be created right from Cerebrata Cerebrata using the New Database option.
Create a new DB in Gremlin.png

Create Containers inside a DB

New graph container can be created inside an exsisting DB right from Cerebrata using the New Container option.

New graph containers.png

In the popup user can provide the container name, partition key, throughput type, throughput and click on save.
User can also create an Indexing policy, Unique Key policy and add TTL config details.

new container window.png

Create: Documents, Stored Procedures, Triggers, Functions

User can create graphs, stored procedures, triggers and functions from Cerebrata using the new icon. User can also create a user from Cerebrata.
Once a graph is created used can also develop vertices for the graph through Cerebrata. User can follow the below steps to create a vertex for a graph.

  1. User can click the New Vertices option in the graph segment
    Create a new vertices.png

  2. In the popup window, user can provide the Vertex label and Partition key value.
    Create a new vertices window.png

Note

To view the vertices, user has to execute the default query.

Read: Graph, Stored Procedures, Triggers, Functions

User can view all the graphs created, stored procedures, triggers and functions by clicking on the open option aligned with the respective entity names.
Open Graph.png

To view all the vertices in a graph user has to execute a query. Cerebrata has a default query, which a user can leverage to view all the vertices and their connections.

Query Help?

To get more information about the query visit: Query help

NOTE

User can save a query and use it for quick access. Saved queries can also be edited or deleted later

Update: Graphs, Stored Procedures, Triggers, Functions

Once the graph is opened after the query execution, the user can right-click on any vertex that needs to be updated.
Now the user will have options to Connect or customize the vertex.

Using the connect to option user can connect the vertex to any other vertices in the graph.
Using the Customize option user can change the look of the vertex as per taste. A user would be allowed to change the node shape, node size, node color

Delete: Documents, Stored Procedures, Triggers, Functions

User can also perform delete operations right from Cerebrata.

Note

All the delete operation performed in Cerebrata is irreversible and will result in loss of data.

Copy Graph

Cerebrata now allows the users to copy the vertices and edges from one Graph and paste them to different Graph. The users can either copy the entire graph or we can copy specific edges or vertices by providing the query.

The below illustration shows how to copy the graph in Gremlin API
Copy Graph

Settings

The user can enhance the management part of Gremlin API in Azure Cosmos DB with Cerebrata's settings. To leverage these settings,

  1. Navigate to Files > Settings > Application Settings > CosmosDB Settings.
    Gremlin API Settings

  2. Fetch the vertices and edges either automatically or by providing query by utilising the Entity Fetch Behaviour option.

  3. Set Tab Behaviour for opening the graph and Behaviour to display the vertices and edges in graph format or JSON format.


Was this article helpful?