Skip to content

Commit bcfafc8

Browse files
Merge pull request #253010 from seesharprun/cosmos-gremlin-quickstarts
Cosmos DB | Revamp Gremlin quickstarts
2 parents 049a89d + 127a397 commit bcfafc8

40 files changed

+681
-1221
lines changed

articles/cosmos-db/.openpublishing.redirection.cosmos-db.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6214,6 +6214,16 @@
62146214
"source_path_from_root": "/articles/cosmos-db/rag-data-openai.md",
62156215
"redirect_url": "/azure/cosmos-db/vector-search",
62166216
"redirect_document_id": true
6217+
},
6218+
{
6219+
"source_path_from_root": "/articles/cosmos-db/gremlin/quickstart-java.md",
6220+
"redirect_url": "/azure/cosmos-db/gremlin/quickstart-console",
6221+
"redirect_document_id": false
6222+
},
6223+
{
6224+
"source_path_from_root": "/articles/cosmos-db/gremlin/quickstart-php.md",
6225+
"redirect_url": "/azure/cosmos-db/gremlin/quickstart-console",
6226+
"redirect_document_id": false
62176227
}
62186228
]
62196229
}

articles/cosmos-db/gremlin/TOC.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@
1010
href: gremlin-api-faq.yml
1111
- name: Quickstarts
1212
items:
13-
- name: Gremlin console
13+
- name: Console
1414
href: quickstart-console.md
15-
- name: .NET
16-
href: quickstart-dotnet.md
17-
- name: Java
18-
href: quickstart-java.md
19-
- name: Node.js
20-
href: quickstart-nodejs.md
2115
- name: Python
2216
href: quickstart-python.md
23-
- name: PHP
24-
href: quickstart-php.md
17+
- name: Node.js
18+
href: quickstart-nodejs.md
19+
- name: .NET
20+
href: quickstart-dotnet.md
2521
- name: Tutorials
2622
items:
2723
- name: Query data using Gremlin
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
author: seesharprun
3+
ms.author: sidandrews
4+
ms.service: cosmos-db
5+
ms.subservice: apache-gremlin
6+
ms.topic: include
7+
ms.date: 09/27/2023
8+
---
9+
10+
1. Create shell variables for *accountName*, *resourceGroupName*, and *location*.
11+
12+
```azurecli-interactive
13+
# Variable for resource group name
14+
resourceGroupName="msdocs-cosmos-gremlin-quickstart"
15+
location="westus"
16+
17+
# Variable for account name with a randomly generated suffix
18+
19+
let suffix=$RANDOM*$RANDOM
20+
accountName="msdocs-gremlin-$suffix"
21+
```
22+
23+
1. If you haven't already, sign in to the Azure CLI using `az login`.
24+
25+
1. Use `az group create` to create a new resource group in your subscription.
26+
27+
```azurecli-interactive
28+
az group create \
29+
--name $resourceGroupName \
30+
--location $location
31+
```
32+
33+
1. Use `az cosmosdb create` to create a new API for NoSQL account with default settings.
34+
35+
```azurecli-interactive
36+
az cosmosdb create \
37+
--resource-group $resourceGroupName \
38+
--name $accountName \
39+
--capabilities "EnableGremlin" \
40+
--locations regionName=$location \
41+
--enable-free-tier true
42+
```
43+
44+
> [!NOTE]
45+
> You can have up to one free tier Azure Cosmos DB account per Azure subscription and must opt-in when creating the account. If this command fails to apply the free tier discount, this means another account in the subscription has already been enabled with free tier.
46+
47+
1. Get the API for Gremlin endpoint *NAME* for the account using `az cosmosdb show`.
48+
49+
```azurecli-interactive
50+
az cosmosdb show \
51+
--resource-group $resourceGroupName \
52+
--name $accountName \
53+
--query "name"
54+
```
55+
56+
1. Find the *KEY* from the list of keys for the account with `az-cosmosdb-keys-list`.
57+
58+
```azurecli-interactive
59+
az cosmosdb keys list \
60+
--resource-group $resourceGroupName \
61+
--name $accountName \
62+
--type "keys" \
63+
--query "primaryMasterKey"
64+
```
65+
66+
1. Record the *NAME* and *KEY* values. You use these credentials later.
67+
68+
1. Create a *database* named `cosmicworks` using `az cosmosdb gremlin database create`.
69+
70+
```azurecli-interactive
71+
az cosmosdb gremlin database create \
72+
--resource-group $resourceGroupName \
73+
--account-name $accountName \
74+
--name "cosmicworks"
75+
```
76+
77+
1. Create a *graph* using `az cosmosdb gremlin graph create`. Name the graph `products`, then set the throughput to `400`, and finally set the partition key path to `/category`.
78+
79+
```azurecli-interactive
80+
az cosmosdb gremlin graph create \
81+
--resource-group $resourceGroupName \
82+
--account-name $accountName \
83+
--database-name "cosmicworks" \
84+
--name "products" \
85+
--partition-key-path "/category" \
86+
--throughput 400
87+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
author: seesharprun
3+
ms.author: sidandrews
4+
ms.service: cosmos-db
5+
ms.subservice: apache-gremlin
6+
ms.topic: include
7+
ms.date: 09/27/2023
8+
---
9+
10+
1. Open your terminal in any folder.
11+
12+
1. Use `az group delete` to delete the resource group.
13+
14+
```azurecli-interactive
15+
az group delete \
16+
--name $resourceGroupName
17+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
author: seesharprun
3+
ms.author: sidandrews
4+
ms.service: cosmos-db
5+
ms.subservice: apache-gremlin
6+
ms.topic: include
7+
ms.date: 09/27/2023
8+
---
9+
10+
> [!div class="op_single_selector"]
11+
>
12+
> - [Console](../quickstart-console.md)
13+
> - [Python](../quickstart-python.md)
14+
> - [Node.js](../quickstart-nodejs.md)
15+
> - [.NET](../quickstart-dotnet.md)
16+
>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)