So, this lesson is going to be
a little bit different.
And to fit in with that vein,
I did a search for odd-looking pictures.
And lo and behold, this is what came up.
And I thought, "Yeah, that kind of fits the bill."
(Brian chuckling) So that's what this lesson's going to be.
It's going to be one of those oddball lessons
that is listed as something that you need to know
for the DP-203,
but only just a little bit.
Let me explain.
So today we will be discussing how to upsert
via output to Cosmos DB.
And if you will remember,
that upserting is just simply a way for us to update data
if it already exists,
or create new rows to data if it does not exist.
Now, you'll note that we are now talking about Cosmos DB.
And you might think to yourself,
"Cosmos DB... that's not really in the DP-203, is it?"
No. You would be correct.
Cosmos DB is not actually in the DP-203.
There's a separate exam just for Cosmos.
With that being said,
we are talking about Azure Stream Analytics
and how we upsert into Cosmos DB,
because it's a requirement.
So we are going to talk about how we do that
by setting our compatibility levels.
And then finally,
we're going to talk about what Cosmos DB is--sort of.
I'm going to give you like a 30-second overview
because, again, Cosmos DB is not on this exam.
So don't think that you need to understand how it works
because you really don't.
Finally, we're going to take a minute to see this in action.
With that, go ahead and jump in and get started.
Upserting via Cosmos DB.
So you can upsert databases from Stream Analytics
only through Azure Cosmos DB currently.
Now with that, you use JSON output
in order to push that into Cosmos DB
and then use your upserting capabilities.
Now, most of the action actually happens
on the Cosmos DB side.
You just need to understand that you can do this.
So from Cosmos DB, you would go in and create containers.
You would also set your billing, performance,
consistency levels, capacity, all that's set in Cosmos.
And I'm not even going to talk about it
because you really don't need to know what that is,
because it's not on the exam.
You just need to know
that you can upsert databases from Stream Analytics
only in Cosmos DB using JSON output.
The next thing you need to do is
you need to look at setting your compatibility level.
Now, this is done in Azure Stream Analytics.
And I'll show you how to do that in just a minute.
But think of compatibility levels kind of like versions.
So right now, we're run version 1.2.
This is what we want to use for upserting.
And then there's a couple of previous generations as well
that has reduced capabilities,
at least as far as upserting is concerned.
So what is Cosmos DB?
Well, it is a globally distributed--
and you'll hear globally like 15,000 times
when you read about Cosmos DB--
but it's a globally distributed NoSQL database.
It contains 5 different consistency levels.
I did mention global, right?
Seriously, you'll hear that a lot
when you talk about Cosmos DB.
It's also multi-model,
which just means that there's a lot of different ways
that you can present your data.
So you can use SQL, or Cassandra, or MongoDB,
or Gremlin, or Table.
So there's quite a few options when you look at it.
And it's got extremely high availability,
again because it's designed
for large-scale production environments.
And so availability, global distribution, multi-model,
all those things are very important.
All right, with that, let's see it in action.
I mean, sort of.
So what I'm going to do is I'm going to go in
and I'm going to show you
what we need to do from the Azure-Stream-Analytics side.
I am not going to dive into Cosmos DB.
All right, with that, let's do it.
So here we find ourselves in Azure Stream Analytics.
We are simply going to scroll down to Compatibility level.
Click, and that easy.
We just go over here.
We choose 1.2. And we would click on Save.
That's all you need to do.
Then you're set with the compatibility level.
And again, just keep in mind that
you would be setting everything else from Cosmos DB
and you're pushing JSON through Azure Stream Analytics.
So in review,
CosmosDB JSON is required for upserts.
Set your compatibility level for 1.2
in Azure Stream Analytics.
And Cosmos DB is a globally available NoSQL service
that isn't on the DP-203.
All right, that's it for this lesson.
Let's jump back into a few more mainstream components.
I'll see in the next lesson.