You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/use-csharp-notebook-features-and-commands.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,14 @@ In a new code cell, insert and run the following code, replacing ``PackageToBeIn
21
21
```csharp
22
22
#r"nuget: PackageToBeInstalled, optionalVersion"
23
23
```
24
+
24
25
You can install multiple NuGet packages in the same cell. Packages will be available to use from any notebook in the Azure Cosmos account workspace.
25
26
26
-
Currently, the C# notebooks workspace does not support recursive resolution of NuGet packages. If a NuGet package has dependencies on other NuGet packages not currently installed, you may have to explicitly reference them along with the parent package.
27
+
Currently, the C# notebooks workspace does not support recursive resolution of NuGet packages. If a NuGet package has dependencies on other NuGet packages that are not currently installed, you have to explicitly reference them along with the parent package.
28
+
29
+
> [!TIP]
30
+
> If your notebook requires a custom package, we recommend that you add a cell to your notebook to install the package and make it the first cell. This reduces the chance of conflicts with other packages that Azure Cosmos DB loads by default. It is also easy to re-install the packages if you [reset the workspace](#reset-notebooks-workspace), which removes all packages.
27
31
28
-
> [!TIP]''
29
-
> If your notebook requires a custom package, we recommend that you add a cell to your notebook to install the package and make it the first cell. This reduces the chance of conflicts with any packages Azure Cosmos DB loads by default. It also makes it easy to re-install them if you [reset the workspace](#reset-notebooks-workspace), which removes all packages.
30
32
## Use the built-in Azure Cosmos DB .NET SDK
31
33
Version 3 of the [Azure Cosmos DB .NET SDK for SQL API](https://github.com/Azure/azure-cosmos-dotnet-v3) is installed and included in the notebook environment for the Azure Cosmos account.
32
34
@@ -47,19 +49,19 @@ CosmosClient cosmosClient = new CosmosClient(Cosmos.Endpoint, Cosmos.Key);
See [.NET SDK samples](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage).
52
+
To learn more, see the [.NET V3 SDK samples](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage).
51
53
52
54
> [!IMPORTANT]
53
55
> The built-in Azure Cosmos DB .NET SDK is only supported for SQL (Core) API accounts. For other APIs, you will need to [install the relevant .NET driver](#install-a-new-nuget-package) that corresponds to the API.
54
56
55
-
## Set custom options using ```CosmosClientOptions```
56
-
For more flexibility, you can set custom ``CosmosClientOptions``to pass in your ``CosmosClient`` instance. You can use this to:
57
+
## Set custom options using ``CosmosClientOptions``
58
+
For more flexibility, you can set the custom ``CosmosClientOptions``property and pass it in your ``CosmosClient`` instance. You can use this property to:
57
59
58
-
- Set an application name in the user-agent suffix to include in every request
59
-
- Set the preferred region to be used to operations against the service
60
-
- Set a custom retry policy on rate-limited requests
60
+
- Set an application name in the user-agent suffix to include it in every request.
61
+
- Set the preferred region to be used when running operations against the service.
62
+
- Set a custom retry policy to handle rate-limited requests.
61
63
62
-
See the [documentation](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions) for all ``CosmosClientOptions``settings.
64
+
See the [CosmosClientOptions API reference](/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions)article for all the supported settings. The following is an example that shows how to set `cosmosClientOptions` property:
63
65
64
66
```csharp
65
67
usingMicrosoft.Azure.Cosmos;
@@ -76,7 +78,7 @@ var client = new CosmosClient(Cosmos.Endpoint, Cosmos.Key, cosmosClientOptions);
76
78
```
77
79
78
80
## Access the account endpoint and primary key variables
79
-
You can access the built-in endpoint and key of the account your notebook is in.
81
+
You can access the built-in endpoint and key of the Azure Cosmos account where your notebook exists.
80
82
81
83
```csharp
82
84
varkey=Cosmos.Key;
@@ -104,9 +106,9 @@ for (int i = 0; i < 5; i++) {
104
106
> Console.WriteLine() syntax is not currently supported in C# notebooks. Use Display.AsMarkdown to print console output from your program.
105
107
106
108
## Use built-in nteract data explorer
107
-
You can use the built-in [nteract data explorer](https://blog.nteract.io/designing-the-nteract-data-explorer-f4476d53f897) to filter and visualize a collection of items. In a cell, put the variable you want to visualize in the last line, which will automatically be displayed in nteract when the cell is run.
109
+
You can use the built-in [nteract data explorer](https://blog.nteract.io/designing-the-nteract-data-explorer-f4476d53f897) to filter and visualize a collection of items. In a cell, put the variable you want to visualize in the last line, which is automatically displayed in nteract when you run the cell.
108
110
109
-
For example, in the GetingStarted_Csharp.ipynb example, we can print out the variable with our result, the ``telemetryEvents``. See the [GettingStarted_Csharp.ipynb notebook](https://github.com/Azure-Samples/cosmos-notebooks/blob/master/CSharp_quickstarts/GettingStarted_CSharp.ipynb) for the entire sample.
111
+
For example, in the *GetingStarted_Csharp.ipynb* example, we can print out the variable with our result, the ``telemetryEvents``. See the [GettingStarted_Csharp.ipynb notebook](https://github.com/Azure-Samples/cosmos-notebooks/blob/master/CSharp_quickstarts/GettingStarted_CSharp.ipynb) for the entire sample.
With the output statistics, you can calculate the effective RU/s used to upload the items. For example, if 25,000 RUs were consumed over 38 seconds, the effective RU/s is 25,000 RUs / 38 seconds = 658 RU/s.
0 commit comments