Skip to content

AzureCosmosDB/cosmos-fabric-samples

Repository files navigation

Cosmos DB in Fabric - Samples Repository

Welcome to the Cosmos DB in Fabric Samples Repository! 🌟

This repository serves as your comprehensive hub for learning and exploring Cosmos DB in Microsoft Fabric through practical, real-world samples. Whether you're just getting started or looking to implement advanced scenarios, you'll find code samples, datasets, and notebooks to accelerate your development journey.

Cosmos DB in Fabric Data Explorer The Cosmos DB in Fabric Data Explorer - where many of these samples begin

🚀 Quick Start

New to Cosmos DB in Fabric? Start here:

  1. Create a Cosmos DB artifact in your Fabric workspace
  2. Load sample data using the Data Explorer (click "SampleData" on the Home screen)
  3. Explore the samples in this repository to learn key concepts and patterns

📚 Documentation & Resources

📋 Samples

Sample Description Prerequisites Difficulty
Simple Query Basic CRUD operations and queries using the sample dataset with basic container management SampleData container Beginner
User Data Functions Complete collection of Cosmos DB operations using Fabric User Data Functions SampleData container, User Data Functions enabled Intermediate
Vector Search AI-powered semantic search using OpenAI embeddings and VectorDistance SampleVectorData container Intermediate
Price-Review Analytics with Spark Price-review correlation analysis using Python Spark SQL with interactive visualizations Cosmos DB with lakehouse shortcuts Advanced
Price-Review Analytics with Power BI Build Power BI dashboards analyzing price-review correlations using Lakehouse SQL views and DAX measures Cosmos DB with lakehouse shortcuts, Power BI Advanced
Spark Connector with Scala Read, query, analyze, and write data using Spark Connector with Scala Custom Spark environment, JAR libraries Intermediate
Advanced Vector Search Enterprise-grade vector search with Azure OpenAI deployment, Key Vault integration, and custom embedding models Azure subscription owner rights, Workspace Identity Advanced
Fraud Detection Real-time credit card fraud detection using vector search, change feed streaming, and anomaly detection with embeddings Cosmos DB with vector index, Spark environment, JAR libraries Advanced
Disaster Recovery Business continuity and disaster recovery procedures using Git integration and OneLake mirroring to restore Cosmos DB artifacts Git integration, OneLake shortcuts, Spark environment Advanced
Management Operations Container management, throughput operations, and robust data loading with retry logic Empty Cosmos DB artifact Beginner

📊 Datasets

Dataset Description Use Case
fabricSampleData.json Product catalog with customer reviews Basic queries and operations
fabricSampleDataVectors-ada-002-1536.json Sample data with Ada-002 embeddings (1536 dimensions) Vector search scenarios
fabricSampleDataVectors-3-large-512.json Sample data with text-embedding-3-large vectors (512 dimensions) Advanced vector operations with Azure OpenAI

🎯 Coming Soon

  • Hybrid Search Samples - Combining vector and traditional search patterns
  • Integration Samples - Connecting with other Fabric services

🛠️ Prerequisites

Before running the samples, ensure you have:

  • Microsoft Fabric workspace
  • Python 3.11+ for notebook samples
  • Azure Cosmos SDK (pip install azure-cosmos)
  • Sample data loaded in your Cosmos DB container (use Data Explorer)

🤝 How to Use This Repository

  1. Browse the samples using the table of contents above
  2. Clone or download the repository to your local machine
  3. Follow the README in each sample folder for specific instructions
  4. Load the datasets using Cosmos DB Data Explorer in Fabric
  5. Run the notebooks in your Fabric workspace

🆘 Need Help?

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

This repository contains samples for Cosmos DB in Fabric

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8