Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Announces General Availability of Jupyter Notebooks Support for Cosmos DB

Microsoft Announces General Availability of Jupyter Notebooks Support for Cosmos DB

Recently Microsoft announced the general availability of Jupyter notebooks support for Cosmos DB, providing integrated support for running queries directly against all data models. As these notebooks run directly inside Cosmos DB; this allows for analyzing and visualizing the data directly from the Azure portal, without the need to extract the data.

As Microsoft's globally distributed NoSQL database service, Cosmos DB implements a wide variety of data models and APIs, such as SQL and Table, but also Cassandra, Gremlin, and Spark. Providing low latency and various consistency models, this service is similar to Amazon's DynamoDB and Google's Cloud Datastore.

Jupyter notebooks support is available for all of the supported Cosmos DB models, meaning it can query data on any of these. Using these notebooks opens a variety of capabilities, such as running interactive queries, exploring, and analyzing the data, after which it is then possible to visualize it. Another option these notebooks provide is in the AI space, by building, training, and running machine learning models.

Additionally, all these capabilities are leveraged through the native Jupyter Python kernel, but it is also possible to make use of so-called magic commands, which allow running SQL API queries. Moreover, it is possible to combine the two of these, leveraging their query and rendering capabilities. As such, these notebooks allow implementation of a wide range of scenarios, as the official documentation explains.

  • Data visualizations: Jupyter notebooks allow you to visualize data in the form of a shared notebook that renders some data set as a graphic. Jupyter notebook lets you author visualizations, share them, and allows interactive changes to the shared code and data set.
  • Code sharing: Services like GitHub provide ways to share code, but they're largely non-interactive. With a Jupyter notebook, you can view code, execute it, and display the results directly in the Azure portal.
  • Live interactions with code: Jupyter notebook code is dynamic; it can be edited and re-run incrementally in real time. Notebooks can also embed user controls (e.g., sliders or text input fields) that can be used as input sources for code, demos or Proof of Concepts(POCs).
  • Documentation of code samples and outcomes of data exploration: If you have a piece of code and you want to explain line-by-line how it works in Azure Cosmos DB with real-time output all along the way, you could embed it in a Jupyter Notebook. The code will remain fully functional. You can add interactivity along with the documentation at the same time.
  • Cosmos magic commands: In Jupyter notebooks, you can use custom magic commands for Azure Cosmos DB to make interactive computing easier. For example, the %%sql magic that allows one to query a Cosmos container using SQL API directly in a notebook.
  • All in one place environment: Jupyter notebooks combine code, rich text, images, videos, animations, mathematical equations, plots, maps, interactive figures, widgets, and graphical user interfaces into a single document.

When it comes to working with the data, Cosmos DB notebooks provide various built-in packages, as well as the capabilities to install additional packages. The announcement of the general availability comes together with the release of version 4 of the Azure Cosmos DB Python SDK for SQL API, which users can call directly from any notebook. Important to note, support for Jupytor on Cosmos DB is currently limited to the Azure regions Australia East, East US, East US 2, North Europe, South Central US, Southeast Asia, UK South, West Europe, and West US 2.

Rate this Article