Run C# notebooks with Azure Cosmos DB
Azure Cosmos DB built-in Jupyter Notebooks support makes it easy to analyze and visualize your Azure Cosmos DB data. Notebooks are directly integrated into the Azure portal and are completely free with your Azure Cosmos DB account.
Today, we’re excited to announce new features, now in preview, to improve the developer and collaboration experience with notebooks. With our new C# notebooks and integration with GitHub, working with your Azure Cosmos DB data is now easier than ever.
In addition to Python notebooks, Azure Cosmos DB now support C# notebooks. The experience is built with .NET developers in mind, so you can interactively write and run C# code, use our built-in Azure Cosmos DB .NET SDK, and import custom NuGet packages. For those looking for an easy way to get started, try out our C# or Python notebook quickstart experience to run operations against Azure Cosmos DB, all within the Azure portal.
Run C# code interactively
In this example, we initialize a new instance of CosmosClient, passing in the built-in account context. Then, we create a new database and container, which appear in the resource tree.
Visualize your data
To visualize your data, simply put a variable in the last line of your code and run the cell. If it’s a collection of items, we’ll automatically open nteract data explorer, an open source visualization tool that we’ve built into the notebook. With nteract, you can view your data in a table format. You can also use pre-built visualizations for ad-hoc exploration or analysis, no code required.
Below, we’re building a bar chart view of the results from an Azure Cosmos DB query.
Use built-in magic commands
Notebooks come with many built-in features to help you work with your Azure Cosmos DB data. Over the past few months, we’ve added and improved our notebook magic commands that help you do common operations against Azure Cosmos DB.
For example, use the %%upload command to quickly upload an array of JSON objects to any container your Azure Cosmos DB account.
Connect your notebooks workspace to GitHub
We’ve heard from many of you that while Azure Cosmos DB makes it easy to work with notebooks, you’d like an easier way to collaborate and share notebooks with others.
With our new integration with GitHub, you can directly connect your notebooks workspace to your GitHub account. Import your repositories and notebooks into your workspace to view, edit, and run your notebooks. When you’re done, save and push directly to GitHub, all conveniently from within Data Explorer.
We support both public and private repos and branches to enable common developer workflows, based on your feedback.
Follow our documentation to enable notebooks on your Azure Cosmos DB account. Try out a Python or C# notebook with one of our built-in samples in the in the Azure Cosmos Explorer or Data Explorer. Connect your notebooks workspace to GitHub to work with notebooks from your public or private repositories.
Share your favorite notebooks with the community by sending them to the Azure Cosmos DB notebooks GitHub repo. We’d love to hear your feedback and see your notebooks built on Azure Cosmos DB!