SlideShare a Scribd company logo
From relational to Multimodel
Azure Cosmos DB
Rudi Bruchez
Yes, it’s me
Rudi Bruchez
rudi@babaluga.com
www.babaluga.com
Overview
Introduction to
CosmosDB
What is Azure CosmosDB
Cosmos DB started in 2010 as “Project Florence”
First availability in 2015 as DocumentDB
Full Cosmos DB released in 2017
What is Azure CosmosDB
Database As A Service
Distributed to regions
Multi models
Multi APIs
What is the model?
CosmosDB Account
{ } Database
Containers
Items
a group of containers
Contains items
Schema-agnostic data
What is in the container?
Containers
Items Contain fields, internally
stored in JSON
Fields By default, each
field is indexed
How you see it in the Data Explorer
How is it stored?
Schema-agnostic containers
Global distribution
Read-only replicas
Multi-master for
NoSQL API
new Azure Cosmos DB
accounts only
September 2018
single digit millisecond write
latency at the 99th percentile
anywhere in the world
Demo – create an account
Demo – geo-replication
Distributed Consistency?
Consistency levels
Consistency level Description %
Eventual No read consistency guaranteed
Consistent prefix Eventual, with write-order consistency
Session RYOW – consistent inside the same
session
73
Bounded
Staleness
Set a time or # of operations’ lag 20
Strong Only one region
2x cheaper
Demo – consistency levels
What is a Session ?
public async Task GetAsync()
{
var response = await this.client.ReadDocumentAsync(…));
string sessionToken = response.SessionToken;
RequestOptions options = new RequestOptions();
options.SessionToken = sessionToken;
var response2 = await
client.ReadDocumentAsync(…, options);
}
Per-request consistency level
Document doc = client.ReadDocumentAsync(
documentLink,
new RequestOptions {
ConsistencyLevel =
ConsistencyLevel.Eventual
}
);
2% of Azure Cosmos DB tenants
Multi-Master Databases
September 2018; in Preview before
New accounts only
Multi-Master Databases
ConnectionPolicy policy = new ConnectionPolicy
{
ConnectionMode = ConnectionMode.Direct,
ConnectionProtocol = Protocol.Tcp,
UseMultipleWriteLocations = true,
};
policy.PreferredLocations.Add("West US");
policy.PreferredLocations.Add("North Europe");
policy.PreferredLocations.Add("Southeast Asia");
Multi-homing API
Global conflict resolution modes
Core (SQL) API has 3 modes:
Last-Writer-Wins (LWW) – the largest value in a
ConflictResolutionPath wins
Custom – User-Defined Procedure – add an UDP with
a special signature to the collection
Custom – Asynchronous – conflicts are not committed,
but registered in the read-only conflicts feed for deferred
resolution by the application.
For all other API models: LWW only.
Choosing conflict resolution mode
DocumentCollection c = await
Client.CreateDocumentCollectionIfNotExistsAsync(
UriFactory.CreateDatabaseUri("Wines"),
new DocumentCollection
{
Id = "Italy",
ConflictResolutionPolicy = new ConflictResolutionPolicy
{
Mode = ConflictResolutionMode.LastWriterWins,
ConflictResolutionPath = "/Timestamp"
}
}
);
https://docs.microsoft.com/fr-fr/azure/cosmos-
db/multi-master-conflict-resolution#code-samples
Pricing
By collection
size
RU per hour (reserved, not effectively used)
RU – Request Units
The capacity of your system
1 RU = 1 Kb for 1 request
Demo – pricing
Data Models
Multi-Model APIs
Multi-Models APIs
API Mapping Compatibility
Core Containers Items
MongoDB Collections Documents MongoDB 3.2, some
3.4 features in preview
Gremlin Graphs Nodes,
Edges
Gremlin 3.2
Cassandra Tables Rows CQL 4
Azure Table
Storage
Table Item
SQL API
Document Database (JSON)
documentDB API
“id” column mandatory, manually or automatically set
SQL language for documents
Demo – creating a collection
What is in the Document?
Property User
settable ?
Purpose
_rid System unique, hierarchical identifier of the
resource
_etag System for optimistic concurrency control
_ts System Last updated timestamp (epoch)
_self System Unique addressable URI of the resource
id Either If the user does not specify, system
generated
eTag Management – OCC, MVCC
var ac = new AccessCondition {
Condition = doc.ETag, Type = AccessConditionType.IfMatch};
this.client.ReplaceDocumentAsync(doc.SelfLink, wine,
new RequestOptions {AccessCondition = ac}
);
060.etag.cs
SQL Queries
• Subset of SQL implemented in Javascript
• Javascript support
• JSON projection
• Intra-document joins
• Support for array iteration in the From clause
SQL Queries
SELECT Name as "Wine Name"
FROM "all-wines"
-- returns a JSON list
SELECT {"Wine Name": Name} as "Wines"
FROM "all-wines"
-- returns a JSON object
SQL Queries
SELECT Name as "Seller Name"
FROM wines.sellers
-- returns a JSON list
SELECT Name as "Seller Name"
FROM w IN wines.sellers
-- returns JSON objects
Intra-document joins
• Only INNER JOIN
• Complete cross product of the sets
participating in the join
SELECT tag.name
FROM food
JOIN tag IN food.tags
WHERE food.id = "09052"
Builtin Functions
Function group Operations
Mathematical
functions
ABS, CEILING, EXP, FLOOR, POWER, ROUND, SIGN, SQRT,
SQUARE, …
Type checking
functions
IS_ARRAY, IS_BOOL, IS_NULL, IS_NUMBER, IS_OBJECT,
IS_STRING, IS_DEFINED, and IS_PRIMITIVE
String functions
CONCAT, CONTAINS, ENDSWITH, INDEX_OF, LEFT, LENGTH,
LOWER, LTRIM, REPLACE, REPLICATE, REVERSE, RIGHT, RTRIM,
STARTSWITH, SUBSTRING, UPPER
Array functions
ARRAY_CONCAT, ARRAY_CONTAINS, ARRAY_LENGTH, and
ARRAY_SLICE
Spatial functions
ST_DISTANCE, ST_WITHIN, ST_INTERSECTS, ST_ISVALID, and
ST_ISVALIDDETAILED
Demos – SQL API
Querying The Wines Container Importing JSON
010.sql and linq against documents.cs
Spatial Data with the SQL API
GeoJSON specification (rfc 7946)
Points, LineStrings, and Polygons
WGS-84 CRS only
World Geodetic System used by
GPS, Google Map, Bing Map
OGC functions : ST_DISTANCE, ST_WITHIN,
ST_INTERSECTS
{
"type":"Polygon",
"coordinates":[ [
[ 31.8, -5 ],
[ 31.8, -4.7 ],
[ 32, -4.7 ],
[ 32, -5 ],
[ 31.8, -5 ]
] ]
}
020.spatial.cs
MongoDB API
JSON Like the SQL API
MongoDB compatible
You can use the MongoDB tools and the mongo
clients
Add an _id identifier to be MongoDB compatible
https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-feature-support
MongoDb Sharding
Importing into Mongo CosmosDB
Mongo
MongoImport
MongoExport
Demos – MongoDB API
The MongoDB API Using the Shell
Demos – MongoDB API
Robo 3T Aggregation Framework
030.mongo.cs
https://community.qlik.com/t5/Technology-Partners-Ecosystem/White-
Paper-Connecting-to-CosmosDB-Mongo-API-using-Qlik-MongoDB/ta-
p/1527975
Table API
Simple Key-Value (KV) store
Get and Set
You can search in values, everything is indexed
Hash table, very fast for keys
API is recent : https://docs.microsoft.com/en-
us/azure/cosmos-db/table-sdk-dotnet
No support yet for .NET Core (use the old one)
Graph API
Based on Tinkerpop, Gremlin language
Edge / arc
Undirected Directed
Property graph
1 2
Name: Doctor Who
Age: 953
Name: Dalek
Type: enemy
A graph database is a property graph
Domain Specific Languages
Cypher
Neo4J
Apache Tinkerpop
MATCH (actor:Person)-[:ACTED_IN]->(movie:Movie)
WHERE movie.title STARTS WITH "T"
RETURN movie.title AS title, collect(actor.name) AS cast
ORDER BY title ASC LIMIT 10;
g.V().as("a").out("knows").as("b").
select("a","b").
by("name").
by("age")
040.movie.gremlin
Demos – graph api
Create a vertex Using Gremlin console
Cassandra API
Apache drivers compliant with CQLv4
All CQL command supported
All Data Types supported
All functions supported
Operations
Documents are stored as a tree
Automatic indexing the tree
Automatic. All fields
are indexed.
Can be set manually,
even by document
Online strategy
changes, no impact
on RUs
Indexing
Consistent: changes happen immediately. higher RU
consumption
Lazy: asynchronous changes, background process.
Query consistency is eventual and RU consumption is
lower.
Index Types
Hash: useful for equality and inequality predicates.
Range: useful for ordering and range searches.
Spatial: useful for spatial queries (within, distance,
etc.)
070.Index.cs
Demo – indexing
Attachments
For binaries
REST API – POST using AtomPub (rfc 5023)
stored in CosmosDB: POST with the raw attachment as
body. 2 headers: Content-Type (MIME type)
and Slug (name)
External: post just the attachment metadata
Internally stored: 2 GB limit per account.
Change feed
Supported now for .NET, Java, Python and Node/JS
SDKs and for Core and Gremlin APIs.
SP, Triggers, UDF
Javascript
UserDefinedFunction regexMatchUdf = new UserDefinedFunction
{
Id = "REGEX_MATCH",
Body = @"function (input, pattern) {
return input.match(pattern) !== null;
};",
};
UserDefinedFunction createdUdf = client.CreateUserDefinedFunctionAsync(
UriFactory.CreateDocumentCollectionUri("testdb", "families"),
regexMatchUdf).Result;
050.ServerSideScripts.cs
Offline emulator
Msi or Docker
Fully supports SQL API and MongoDB collections
Table, Graph, Cassandra not fully supported (yet)
No scalability, obviously
localhost:8081
Using the local emulator
Develop for free without an Azure account
Docker :
microsoft/azure-cosmosdb-emulator
Docker Windows Container
Allowing Windows and Linux Containers
Linux Containers on Windows (LCOW)
Instead of Linux VM
Data migration tool
From
JSON files, MongoDB
SQL Server, CSV
Azure Table storage
Amazon DynamoDB
HBase
Azure Cosmos DB collections
To
SQL API – all sources
Table API - Data Migration tool
or AzCopy.
MongoDB API - export only,
import using MongoDB tools
Graph API - not supported yet
Data migration tool
https://github.com/azure/azure-documentdb-datamigrationtool
Change Feed
Partitioning
Automatic physical partitioning if RU/s >= 1000
API Partition key Row key
SQL Custom partition key path Fixed id
MongoDB Custom shard key Fixed _id
Gremlin Custom partition key property Fixed id
Table Fixed PartitionKey
Fixed
RowKey
New – Apache Spark Execution
Resources
https://docs.microsoft.com/en-us/azure/cosmos-db/query-cheat-sheet
Azure Cosmos DB query cheat sheets

More Related Content

What's hot

Polygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @OakjugPolygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @Oakjug
Chris Richardson
 
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
Landoop Ltd
 
RedisConf18 - Redis and Elasticsearch
RedisConf18 - Redis and ElasticsearchRedisConf18 - Redis and Elasticsearch
RedisConf18 - Redis and Elasticsearch
Redis Labs
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
Bishal Khanal
 
Sparkling Water Meetup
Sparkling Water MeetupSparkling Water Meetup
Sparkling Water Meetup
Sri Ambati
 
Scaling massive elastic search clusters - Rafał Kuć - Sematext
Scaling massive elastic search clusters - Rafał Kuć - SematextScaling massive elastic search clusters - Rafał Kuć - Sematext
Scaling massive elastic search clusters - Rafał Kuć - Sematext
Rafał Kuć
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB
 

What's hot (7)

Polygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @OakjugPolygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @Oakjug
 
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
From Big to Fast Data. How #kafka and #kafka-connect can redefine you ETL and...
 
RedisConf18 - Redis and Elasticsearch
RedisConf18 - Redis and ElasticsearchRedisConf18 - Redis and Elasticsearch
RedisConf18 - Redis and Elasticsearch
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Sparkling Water Meetup
Sparkling Water MeetupSparkling Water Meetup
Sparkling Water Meetup
 
Scaling massive elastic search clusters - Rafał Kuć - Sematext
Scaling massive elastic search clusters - Rafał Kuć - SematextScaling massive elastic search clusters - Rafał Kuć - Sematext
Scaling massive elastic search clusters - Rafał Kuć - Sematext
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
 

Similar to Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB

Tech-Spark: Exploring the Cosmos DB
Tech-Spark: Exploring the Cosmos DBTech-Spark: Exploring the Cosmos DB
Tech-Spark: Exploring the Cosmos DB
Ralph Attard
 
Azure CosmosDb
Azure CosmosDbAzure CosmosDb
Azure CosmosDb
Marco Parenzan
 
Zero to 60 with Azure Cosmos DB
Zero to 60 with Azure Cosmos DBZero to 60 with Azure Cosmos DB
Zero to 60 with Azure Cosmos DB
Adnan Hashmi
 
Time Series Analytics Azure ADX
Time Series Analytics Azure ADXTime Series Analytics Azure ADX
Time Series Analytics Azure ADX
Riccardo Zamana
 
Deep Dive on ArangoDB
Deep Dive on ArangoDBDeep Dive on ArangoDB
Deep Dive on ArangoDB
Max Neunhöffer
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
Shubhra Kar
 
MongoDB @ fliptop
MongoDB @ fliptopMongoDB @ fliptop
MongoDB @ fliptop
Robbie Cheng
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Azure CosmosDb - Where we are
Azure CosmosDb - Where we areAzure CosmosDb - Where we are
Azure CosmosDb - Where we are
Marco Parenzan
 
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
Amazon Web Services
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
Udaiappa Ramachandran
 
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
Amazon Web Services
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
BizTalk360
 
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Andre Essing
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
Philip Zhong
 
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
In-Memory Computing Summit
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDBDeep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
ArangoDB Database
 
Schema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDBSchema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDB
Dharma Shukla
 

Similar to Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB (20)

Tech-Spark: Exploring the Cosmos DB
Tech-Spark: Exploring the Cosmos DBTech-Spark: Exploring the Cosmos DB
Tech-Spark: Exploring the Cosmos DB
 
Azure CosmosDb
Azure CosmosDbAzure CosmosDb
Azure CosmosDb
 
Zero to 60 with Azure Cosmos DB
Zero to 60 with Azure Cosmos DBZero to 60 with Azure Cosmos DB
Zero to 60 with Azure Cosmos DB
 
Time Series Analytics Azure ADX
Time Series Analytics Azure ADXTime Series Analytics Azure ADX
Time Series Analytics Azure ADX
 
Deep Dive on ArangoDB
Deep Dive on ArangoDBDeep Dive on ArangoDB
Deep Dive on ArangoDB
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
MongoDB @ fliptop
MongoDB @ fliptopMongoDB @ fliptop
MongoDB @ fliptop
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Azure CosmosDb - Where we are
Azure CosmosDb - Where we areAzure CosmosDb - Where we are
Azure CosmosDb - Where we are
 
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
Serverless Analytics with Amazon Redshift Spectrum, AWS Glue, and Amazon Quic...
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
AWS re:Invent 2016: How Thermo Fisher Is Reducing Mass Spectrometry Experimen...
 
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud DatabaseAzure Cosmos DB - The Swiss Army NoSQL Cloud Database
Azure Cosmos DB - The Swiss Army NoSQL Cloud Database
 
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
Azure Cosmos DB - NoSQL Strikes Back (An introduction to the dark side of you...
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
IMC Summit 2016 Breakout - William Bain - Implementing Extensible Data Struct...
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDBDeep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
 
Schema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDBSchema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDB
 

More from PowerSaturdayParis

Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre servicePower Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
PowerSaturdayParis
 
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power PlatformPower Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
PowerSaturdayParis
 
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
PowerSaturdayParis
 
Power Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 securityPower Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 security
PowerSaturdayParis
 
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
PowerSaturdayParis
 
Power Saturday 2019 F4 - The rise of the citizen developer
Power Saturday 2019 F4 - The rise of the citizen developerPower Saturday 2019 F4 - The rise of the citizen developer
Power Saturday 2019 F4 - The rise of the citizen developer
PowerSaturdayParis
 
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
PowerSaturdayParis
 
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps formsPower Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
PowerSaturdayParis
 
Power Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPower Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplained
PowerSaturdayParis
 
Power Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accountingPower Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accounting
PowerSaturdayParis
 
Power Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practicesPower Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practices
PowerSaturdayParis
 
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAXPower Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
PowerSaturdayParis
 
Power Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embeddedPower Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embedded
PowerSaturdayParis
 
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
PowerSaturdayParis
 
Power Saturday 2019 D2 - Capture your store visit with PowerApps
Power Saturday 2019 D2 - Capture your store visit with PowerAppsPower Saturday 2019 D2 - Capture your store visit with PowerApps
Power Saturday 2019 D2 - Capture your store visit with PowerApps
PowerSaturdayParis
 
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoMLPower Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
PowerSaturdayParis
 
Power Saturday 2019 C5 - Driving Power BI automation through monitoring
Power Saturday 2019 C5 - Driving Power BI automation through monitoringPower Saturday 2019 C5 - Driving Power BI automation through monitoring
Power Saturday 2019 C5 - Driving Power BI automation through monitoring
PowerSaturdayParis
 
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big DataPower Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
PowerSaturdayParis
 
Power Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep divePower Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep dive
PowerSaturdayParis
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbook
PowerSaturdayParis
 

More from PowerSaturdayParis (20)

Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre servicePower Saturday 2019 S2 - Version avancée de création de Teams en libre service
Power Saturday 2019 S2 - Version avancée de création de Teams en libre service
 
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power PlatformPower Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
Power Saturday 2019 F2 - La combinaison de Dynamics 365 avec la Power Platform
 
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
Power Saturday 2019 E6 - Day-to-day processes optimization in Office 365
 
Power Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 securityPower Saturday 2019 E1 - Office 365 security
Power Saturday 2019 E1 - Office 365 security
 
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
Power Saturday 2019 F6 - I developed a SPFx solution, what to do next and how...
 
Power Saturday 2019 F4 - The rise of the citizen developer
Power Saturday 2019 F4 - The rise of the citizen developerPower Saturday 2019 F4 - The rise of the citizen developer
Power Saturday 2019 F4 - The rise of the citizen developer
 
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
Power Saturday 2019 F3 - Enabling external sharing in Office365 SharePoint an...
 
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps formsPower Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
Power Saturday 2019 E5 - Spice up your SharePoint lists with PowerApps forms
 
Power Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPower Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplained
 
Power Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accountingPower Saturday 2019 - D6 - Design thinking and innovation accounting
Power Saturday 2019 - D6 - Design thinking and innovation accounting
 
Power Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practicesPower Saturday 2019 - D4 - Doctor Fow best practices
Power Saturday 2019 - D4 - Doctor Fow best practices
 
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAXPower Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
Power Saturday 2019 C4 - CALCULATE the Swiss Army Knife in DAX
 
Power Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embeddedPower Saturday 2019 C1 - Power BI embedded
Power Saturday 2019 C1 - Power BI embedded
 
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
Power Saturday 2019 D3 - Contruisons une solution de OnBoarding avec Graph et...
 
Power Saturday 2019 D2 - Capture your store visit with PowerApps
Power Saturday 2019 D2 - Capture your store visit with PowerAppsPower Saturday 2019 D2 - Capture your store visit with PowerApps
Power Saturday 2019 D2 - Capture your store visit with PowerApps
 
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoMLPower Saturday 2019 C6 - Power BI + Machine Learning = AutoML
Power Saturday 2019 C6 - Power BI + Machine Learning = AutoML
 
Power Saturday 2019 C5 - Driving Power BI automation through monitoring
Power Saturday 2019 C5 - Driving Power BI automation through monitoringPower Saturday 2019 C5 - Driving Power BI automation through monitoring
Power Saturday 2019 C5 - Driving Power BI automation through monitoring
 
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big DataPower Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
Power Saturday 2019 A6 - les nouveautés SQL Server 2019 et le Big Data
 
Power Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep divePower Saturday 2019 A3 - Azure Data Factory deep dive
Power Saturday 2019 A3 - Azure Data Factory deep dive
 
Power Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbookPower Saturday 2019 B6 - SQL Server installation cookbook
Power Saturday 2019 B6 - SQL Server installation cookbook
 

Recently uploaded

Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 

Recently uploaded (20)

Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 

Power Saturday 2019 B4 - From relational to Multimodel Azure Cosmos DB

  • 1. From relational to Multimodel Azure Cosmos DB Rudi Bruchez
  • 2. Yes, it’s me Rudi Bruchez rudi@babaluga.com www.babaluga.com
  • 5. What is Azure CosmosDB Cosmos DB started in 2010 as “Project Florence” First availability in 2015 as DocumentDB Full Cosmos DB released in 2017
  • 6. What is Azure CosmosDB Database As A Service Distributed to regions Multi models Multi APIs
  • 7. What is the model? CosmosDB Account { } Database Containers Items a group of containers Contains items Schema-agnostic data
  • 8. What is in the container? Containers Items Contain fields, internally stored in JSON Fields By default, each field is indexed
  • 9. How you see it in the Data Explorer
  • 10. How is it stored? Schema-agnostic containers
  • 11. Global distribution Read-only replicas Multi-master for NoSQL API new Azure Cosmos DB accounts only September 2018 single digit millisecond write latency at the 99th percentile anywhere in the world
  • 12. Demo – create an account
  • 15. Consistency levels Consistency level Description % Eventual No read consistency guaranteed Consistent prefix Eventual, with write-order consistency Session RYOW – consistent inside the same session 73 Bounded Staleness Set a time or # of operations’ lag 20 Strong Only one region 2x cheaper
  • 17. What is a Session ? public async Task GetAsync() { var response = await this.client.ReadDocumentAsync(…)); string sessionToken = response.SessionToken; RequestOptions options = new RequestOptions(); options.SessionToken = sessionToken; var response2 = await client.ReadDocumentAsync(…, options); }
  • 18. Per-request consistency level Document doc = client.ReadDocumentAsync( documentLink, new RequestOptions { ConsistencyLevel = ConsistencyLevel.Eventual } ); 2% of Azure Cosmos DB tenants
  • 19. Multi-Master Databases September 2018; in Preview before New accounts only
  • 20. Multi-Master Databases ConnectionPolicy policy = new ConnectionPolicy { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Tcp, UseMultipleWriteLocations = true, }; policy.PreferredLocations.Add("West US"); policy.PreferredLocations.Add("North Europe"); policy.PreferredLocations.Add("Southeast Asia"); Multi-homing API
  • 21. Global conflict resolution modes Core (SQL) API has 3 modes: Last-Writer-Wins (LWW) – the largest value in a ConflictResolutionPath wins Custom – User-Defined Procedure – add an UDP with a special signature to the collection Custom – Asynchronous – conflicts are not committed, but registered in the read-only conflicts feed for deferred resolution by the application. For all other API models: LWW only.
  • 22. Choosing conflict resolution mode DocumentCollection c = await Client.CreateDocumentCollectionIfNotExistsAsync( UriFactory.CreateDatabaseUri("Wines"), new DocumentCollection { Id = "Italy", ConflictResolutionPolicy = new ConflictResolutionPolicy { Mode = ConflictResolutionMode.LastWriterWins, ConflictResolutionPath = "/Timestamp" } } ); https://docs.microsoft.com/fr-fr/azure/cosmos- db/multi-master-conflict-resolution#code-samples
  • 23. Pricing By collection size RU per hour (reserved, not effectively used) RU – Request Units The capacity of your system 1 RU = 1 Kb for 1 request
  • 27. Multi-Models APIs API Mapping Compatibility Core Containers Items MongoDB Collections Documents MongoDB 3.2, some 3.4 features in preview Gremlin Graphs Nodes, Edges Gremlin 3.2 Cassandra Tables Rows CQL 4 Azure Table Storage Table Item
  • 28. SQL API Document Database (JSON) documentDB API “id” column mandatory, manually or automatically set SQL language for documents
  • 29. Demo – creating a collection
  • 30. What is in the Document? Property User settable ? Purpose _rid System unique, hierarchical identifier of the resource _etag System for optimistic concurrency control _ts System Last updated timestamp (epoch) _self System Unique addressable URI of the resource id Either If the user does not specify, system generated
  • 31. eTag Management – OCC, MVCC var ac = new AccessCondition { Condition = doc.ETag, Type = AccessConditionType.IfMatch}; this.client.ReplaceDocumentAsync(doc.SelfLink, wine, new RequestOptions {AccessCondition = ac} ); 060.etag.cs
  • 32. SQL Queries • Subset of SQL implemented in Javascript • Javascript support • JSON projection • Intra-document joins • Support for array iteration in the From clause
  • 33. SQL Queries SELECT Name as "Wine Name" FROM "all-wines" -- returns a JSON list SELECT {"Wine Name": Name} as "Wines" FROM "all-wines" -- returns a JSON object
  • 34. SQL Queries SELECT Name as "Seller Name" FROM wines.sellers -- returns a JSON list SELECT Name as "Seller Name" FROM w IN wines.sellers -- returns JSON objects
  • 35. Intra-document joins • Only INNER JOIN • Complete cross product of the sets participating in the join SELECT tag.name FROM food JOIN tag IN food.tags WHERE food.id = "09052"
  • 36. Builtin Functions Function group Operations Mathematical functions ABS, CEILING, EXP, FLOOR, POWER, ROUND, SIGN, SQRT, SQUARE, … Type checking functions IS_ARRAY, IS_BOOL, IS_NULL, IS_NUMBER, IS_OBJECT, IS_STRING, IS_DEFINED, and IS_PRIMITIVE String functions CONCAT, CONTAINS, ENDSWITH, INDEX_OF, LEFT, LENGTH, LOWER, LTRIM, REPLACE, REPLICATE, REVERSE, RIGHT, RTRIM, STARTSWITH, SUBSTRING, UPPER Array functions ARRAY_CONCAT, ARRAY_CONTAINS, ARRAY_LENGTH, and ARRAY_SLICE Spatial functions ST_DISTANCE, ST_WITHIN, ST_INTERSECTS, ST_ISVALID, and ST_ISVALIDDETAILED
  • 37. Demos – SQL API Querying The Wines Container Importing JSON 010.sql and linq against documents.cs
  • 38. Spatial Data with the SQL API GeoJSON specification (rfc 7946) Points, LineStrings, and Polygons WGS-84 CRS only World Geodetic System used by GPS, Google Map, Bing Map OGC functions : ST_DISTANCE, ST_WITHIN, ST_INTERSECTS { "type":"Polygon", "coordinates":[ [ [ 31.8, -5 ], [ 31.8, -4.7 ], [ 32, -4.7 ], [ 32, -5 ], [ 31.8, -5 ] ] ] } 020.spatial.cs
  • 39. MongoDB API JSON Like the SQL API MongoDB compatible You can use the MongoDB tools and the mongo clients Add an _id identifier to be MongoDB compatible https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-feature-support
  • 41. Importing into Mongo CosmosDB Mongo MongoImport MongoExport
  • 42. Demos – MongoDB API The MongoDB API Using the Shell
  • 43. Demos – MongoDB API Robo 3T Aggregation Framework 030.mongo.cs https://community.qlik.com/t5/Technology-Partners-Ecosystem/White- Paper-Connecting-to-CosmosDB-Mongo-API-using-Qlik-MongoDB/ta- p/1527975
  • 44. Table API Simple Key-Value (KV) store Get and Set You can search in values, everything is indexed Hash table, very fast for keys API is recent : https://docs.microsoft.com/en- us/azure/cosmos-db/table-sdk-dotnet No support yet for .NET Core (use the old one)
  • 45. Graph API Based on Tinkerpop, Gremlin language
  • 48. Property graph 1 2 Name: Doctor Who Age: 953 Name: Dalek Type: enemy A graph database is a property graph
  • 49. Domain Specific Languages Cypher Neo4J Apache Tinkerpop MATCH (actor:Person)-[:ACTED_IN]->(movie:Movie) WHERE movie.title STARTS WITH "T" RETURN movie.title AS title, collect(actor.name) AS cast ORDER BY title ASC LIMIT 10; g.V().as("a").out("knows").as("b"). select("a","b"). by("name"). by("age") 040.movie.gremlin
  • 50. Demos – graph api Create a vertex Using Gremlin console
  • 51. Cassandra API Apache drivers compliant with CQLv4 All CQL command supported All Data Types supported All functions supported
  • 53. Documents are stored as a tree
  • 54. Automatic indexing the tree Automatic. All fields are indexed. Can be set manually, even by document Online strategy changes, no impact on RUs
  • 55. Indexing Consistent: changes happen immediately. higher RU consumption Lazy: asynchronous changes, background process. Query consistency is eventual and RU consumption is lower.
  • 56. Index Types Hash: useful for equality and inequality predicates. Range: useful for ordering and range searches. Spatial: useful for spatial queries (within, distance, etc.) 070.Index.cs
  • 58. Attachments For binaries REST API – POST using AtomPub (rfc 5023) stored in CosmosDB: POST with the raw attachment as body. 2 headers: Content-Type (MIME type) and Slug (name) External: post just the attachment metadata Internally stored: 2 GB limit per account.
  • 59. Change feed Supported now for .NET, Java, Python and Node/JS SDKs and for Core and Gremlin APIs.
  • 60. SP, Triggers, UDF Javascript UserDefinedFunction regexMatchUdf = new UserDefinedFunction { Id = "REGEX_MATCH", Body = @"function (input, pattern) { return input.match(pattern) !== null; };", }; UserDefinedFunction createdUdf = client.CreateUserDefinedFunctionAsync( UriFactory.CreateDocumentCollectionUri("testdb", "families"), regexMatchUdf).Result; 050.ServerSideScripts.cs
  • 61. Offline emulator Msi or Docker Fully supports SQL API and MongoDB collections Table, Graph, Cassandra not fully supported (yet) No scalability, obviously localhost:8081
  • 62. Using the local emulator Develop for free without an Azure account Docker : microsoft/azure-cosmosdb-emulator Docker Windows Container
  • 63. Allowing Windows and Linux Containers Linux Containers on Windows (LCOW) Instead of Linux VM
  • 64. Data migration tool From JSON files, MongoDB SQL Server, CSV Azure Table storage Amazon DynamoDB HBase Azure Cosmos DB collections To SQL API – all sources Table API - Data Migration tool or AzCopy. MongoDB API - export only, import using MongoDB tools Graph API - not supported yet
  • 67. Partitioning Automatic physical partitioning if RU/s >= 1000 API Partition key Row key SQL Custom partition key path Fixed id MongoDB Custom shard key Fixed _id Gremlin Custom partition key property Fixed id Table Fixed PartitionKey Fixed RowKey
  • 68. New – Apache Spark Execution