We already saw the steps for creating Azure Databricks workspace creation and Cluster creation in a previous article
Step 1 - Cosmos DB creation with sample data.

Step 2 - Cosmos DB Spark Connector library creation
We will go to our existing Azure Databricks cluster and add Cosmos DB Spark connector library. This library is an open source library made by Microsoft employees and other contributors written in JAVA and Scala. (Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM let you build high-performance systems with easy access to huge ecosystems of libraries.)
The entire source code for this connector can be found at Github
You can browse the library file from your local system (which we downloaded from maven repository link)
Step 3 - Querying the Cosmos DB data using Scala notebook.
We created this notebook with Scala language. Azure Databricks supports Python, R and SQL also.
Import the required libraries to our notebook using the below command and click Shift Enter.
It will execute our command. It is the short cut to run the commands.

Join the conversation! Your thoughts help the community grow.