Do You Know Azure Cosmos Db Built-In Notebooks?

Published Apr 30 2020 11:51 AM 1,707 Views

Azure Cosmos DB is Microsoft's globally distributed multi-model database service. It was built from the ground up with global distribution and horizontal scaling across all Azure regions.


Jupyter Notebooks are open-source web applications that allow you to create and share documents that contain live code, equations, visualizations, and narrative text.


In this blog post you will know more about Azure Cosmos DB built-in Jupyter Notebooks, that support all APIs and run within the Azure Cosmos DB accounts.




Here are some important features that will improve your productivity while using the notebooks:



  • Azure Cosmos DB Python SDK V4: It is pre-installed and included in all notebooks. Your cosmos_client object will be pre-loaded with environment information about your Azure Cosmos account, saving you the work to inform database, key, and endpoint. But you can also create a custom version of the client, with information from another Azure Cosmos account.


  • Pre-Installed packages: Pandas, Matplotlib, among others. It means that you don’t need any installation to write, read, and analyze Cosmos DB data.


  • Packages Installation: You can install packages using pip install, making it available for all notebooks in the Azure Cosmos DB account.


  • Magic Commands: You can use the %%sql magic command to run a SQL query against any container in your account and load the results into a Pandas DataFrame. Or you can use %%upload to upload data from a JSON file to a specified Azure Cosmos container. You can also use %database and %container to set default parameters for your queries.


  • Memory management: You have up to 3.9 GB or memory, and you can release some of it cleaning outputs or resetting the workspace.


  • Spark Integration: You can select any of the existing Azure Synapse Spark Pools in your subscription. And for them you have 3 Kernel Twinkles available: Python, DotNet, and Scala.


  • Terminal, that gives you console access to the Linux compute node that runs your Jupyter Notebooks.


  • Direct Access: Your Azure Cosmos DB Data Explorer, including the Notebooks, are also available at Cosmos DB User Interface:


  • Built-in nteract data explorer: You can use the built-in nteract data explorer to filter and visualize a Pandas DataFrame.



The Azure Cosmos Portal comes with an array of samples for you to use and get started from. These notebooks can be used for demos, trainings, and source for tests and projects. When you open one of them, it is automatically copied to your My Notebooks folder, where you can not only use it, but also customize it, as necessary.


Collaboration is appreciated. If you’d like to contribute a Notebook and potentially have it appear as one of our Sample Notebooks, you can submit a PR on our GitHub page.


With Sample Notebooks you can learn by doing, and today we have options for visualization, Request Units, Indexing, Global Distribution, Stored Procedures, and IoT - AI integration.


Cosmic notebooks are available for all data models and APIs including Cassandra, MongoDB, SQL (Core), Gremlin, and Spark to enhance the developer experience in Azure Cosmos DB. Developers, data scientists, engineers and analysts can use the familiar Jupyter Notebooks experience to run interactive queries, explore and analyze data, and work with machine learning models.

1 Comment
Regular Visitor

Hi Rodrigo,


Informative post.


Question - I couldn't find "New Notebook" option in my existing Cosmos DB and even checked by creating the new Cosmos DB account also. And I have Cosmos DB running in Jupyter Notebook supported regions.


It seems like I'm missing some thing. Any comment?

Version history
Last update:
‎Apr 30 2020 11:53 AM
Updated by: