SlideShare a Scribd company logo
1 of 69
Download to read offline
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 / @OakjugChris 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 ElasticsearchRedis Labs
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architectureBishal Khanal
 
Sparkling Water Meetup
Sparkling Water MeetupSparkling Water Meetup
Sparkling Water MeetupSri 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ć - SematextRafał 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 DiveMongoDB
 

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 DBRalph Attard
 
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 DBAdnan Hashmi
 
Time Series Analytics Azure ADX
Time Series Analytics Azure ADXTime Series Analytics Azure ADX
Time Series Analytics Azure ADXRiccardo Zamana
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Azure CosmosDb - Where we are
Azure CosmosDb - Where we areAzure CosmosDb - Where we are
Azure CosmosDb - Where we areMarco 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
 
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 DatabaseBizTalk360
 
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 MongoDBJustin 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 AtlasData Con LA
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip 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 ArangoDBArangoDB Database
 
Schema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDBSchema Agnostic Indexing with Azure DocumentDB
Schema Agnostic Indexing with Azure DocumentDBDharma 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 servicePowerSaturdayParis
 
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 PlatformPowerSaturdayParis
 
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 365PowerSaturdayParis
 
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 securityPowerSaturdayParis
 
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 developerPowerSaturdayParis
 
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 formsPowerSaturdayParis
 
Power Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPower Saturday 2019 E3 - SharePoint unexplained
Power Saturday 2019 E3 - SharePoint unexplainedPowerSaturdayParis
 
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 accountingPowerSaturdayParis
 
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 practicesPowerSaturdayParis
 
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 DAXPowerSaturdayParis
 
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 embeddedPowerSaturdayParis
 
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 PowerAppsPowerSaturdayParis
 
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 = AutoMLPowerSaturdayParis
 
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 monitoringPowerSaturdayParis
 
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 DataPowerSaturdayParis
 
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 divePowerSaturdayParis
 
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 cookbookPowerSaturdayParis
 

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

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

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