Skip to content

AzureCosmosDB/cosmos-fabric-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

123 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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
Customer 360 Reverse ETL End-to-end reverse ETL pipeline: enrich customer profiles in Fabric, write to Azure Cosmos DB with embeddings, and serve a semantic search web app Azure subscription, Fabric Lakehouse with WWI data, Azure OpenAI Advanced
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
Data Pipelines Medallion pipeline (Bronze→Silver→Gold) with reverse ETL writing enriched insights back to Cosmos DB and pipeline metadata logging Cosmos DB with lakehouse shortcuts, Spark environment, User Data Functions Intermediate
Translytical Task Flows Build end-to-end translytical workflows combining Cosmos DB, User Data Functions, and Power BI for real-time data updates SampleData container, User Data Functions, Power BI Desktop Intermediate
Translytical Task Flows β€” NoSQL Schema Clinical trial adverse event triage with type-specific write-back protocols β€” showcases Cosmos DB's schema-agnostic document model to store and update mixed-schema documents in a single container, something only possible with a NoSQL database User Data Functions, Power BI Desktop Advanced
Travel Multi-Agent Analytics Analyze multi-agent memory patterns, trip planning behavior, and user preferences β€” mirror Cosmos DB to Fabric, build analytical Delta tables with Spark, and visualize with Power BI Travel Multi-Agent Workshop deployed, Cosmos DB Mirroring, Fabric Lakehouse, Power BI Desktop Advanced

πŸ“Š 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 opencode@microsoft.com 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

 
 
 

Contributors