>> Learn how you can develop apps with
Azure SQL database for free
with the new Azure SQL database emulator,
as well as getting some other benefits
from working with containers and CIC.
This week on Data Exposed.
[MUSIC].
>> Hi, I'm Anna Hoffman.
Welcome to this episode of Data Exposed.
Today I'm joined by Drew and we have a really exciting topic.
Drew, first, I just want to welcome you on Data Exposed.
>> Thanks Anna, really glad to be here.This is going to be fun.
>> It is going to really fun.
Today, we're going to be talking about how you can develop
Azure SQL database for free.
Yes, you heard that correctly.
This is something I just learned about, really exciting.
Drew, what does this mean?
>> As a PM and SQL focusing on developers and
making things easier for them to develop apps with Azure SQL.
One of the challenges that I've seen
is when you're working with Azure SQL database,
it's got all these great features,
but sometimes you just want to work
locally and have a little bit more flexibility.
I want to try something out quick,
but I don't want to spin up a new Azure SQL database.
Through containers, you can have
a local version of your Azure SQL database.
If I can show you an example real quick of an app I'm working on,
I can show you how it fits together.
>> That'd be great.
>> I have a website. It's not real fancy.
You just can kind of add different reactions
and it'll track with the trending topics are.
Overall, it's just a static web app,
some Azure function APIs,
and then an Azure SQL database.
If I want to change this app,
I don't necessarily want to mess with
the live production database and I
don't want to start a new database,
so I'd like to do that for free.
I'm going to pop over into Azure Data Studio
where I have that database
connected so I can see the data that's out there right now.
But from that table, from these schemas,
I can get a new copy of
this database schema locally by bringing it into a SQL project.
I've talked about SQL projects from time to time in terms of
this tool for developing different database schemas.
But what's really great about them in
the context of working with Azure SQL database,
is now you've brought a copy of your schema locally
so I can create a project from my database.
I'm going to call the target project my reactions.
I'm going to throw it in my sample sandbox.
I'm going to create that project.
This is extracting the schema out.
That means that I'll have files for each of
the objects within the database.
You know my favorite part about having
files for schema objects is Anna?
>> What?
>> That now you can bring it into source control.
You have a file that represents a table.
You can track the state in source control.
It's like developing pieces of your app,
but it's the database.
I might be a geek, but that's really exciting to me.
>> Definitely. I think it's super valuable
too because you can see the changes that are happening,
and you have one place that keeps track of all of it.
>> That's exactly it.
Now, I have my database project that
matches those tables that we saw on the database.
Here's where we can get started with our development.
>> I right click on that database project,
there's a public option.
It's going to walk me through
publishing to a new Azure SQL database instance.
Looks like I need to change my target platform real quick
to Azure SQL database area.
It will offer me a new Azure SQL local development container.
This is going to bring me completely
offline for my development needs.
>> This one is cool because you don't have to specify what region,
what size, or anything,
you just skip it database because you don't care right now?
>> Frankly. The only thing I care about at the moment
is that I'm going to choose between the two Emulator versions.
>> There's a full version that has more features,
and then there's a lite version that oftentimes
covers your baseline functionality.
For me right now on my Mac,
that's the one that I'm going to be using.
That's going to grab the Azure SQL edge container.
It's going to adjust it to be a little bit
closer to Azure SQL database,
and it's going to deploy this whole schema right out to it.
While that's happening,
I could be grabbing
my Azure function APIs and getting ready to work with
those and update them and testing those
locally with my new emulator container.
The container is being deployed.
If I take a look at the containers
that I have on my computer right now,
we can see that a new one has been started.
That'll be ready to connect to here in
just a moment once the deck packs finished deploying.
The deck pack that's deploying,
again, has that whole schema in it.
As soon as I go connect to my local host now,
we're going to see that same database right there for us.
>> Nice. In a minute or two,
you're able to extract it from the existing one,
save it, and create a local one,
and now you can just get to developing?
>> Exactly. I've got
the database running locally that I can do development on.
I also have my database code in a repository,
so I can check that in if I want to.
Then I'm ready to go to work on my app.
The database part is always exciting.
It's great to have all these features.
But at the same time, sometimes I want to be able to
get onto working on my app code faster.
We were able to do that in just a few minutes.
>> That's pretty amazing. This solution
is going to allow people to work for free,
work quickly and also be able to do things like CICD.
Is that right Drew?
>> Yeah. That's right on.
You can check this stuff into code,
the database project files.
In your files,
we've got the object definitions,
but then there's also that.sqlproj file.
When you check this into GitHub,
there's a GitHub Action, Azure SQL action.
You can tell it the connection string for your Azure SQL database,
the path of that SQL project file,
and that you want to publish your updates to it.
It'll take care of things like maybe updating and
Azure firewall rule temporarily
so that it can access the database.
Then it's also going to update
the database with the changes
that you've made locally to your SQL.
Not only are you developing
locally with the Azure SQL database emulator,
because it's based on SQL projects,
they are then set up to publish to your database live later.
>> That is really cool.
You convince me, I'm going to go figure out how to do this.
What are some tips for getting started?
>> This is all based on containers.
If you don't already have a container runtime like Docker,
go ahead and make sure that you get that downloaded and setup.
We do have a QuickStart in the docs.
You go to the link in the description,
that'll get you to these documentation
where you've got the quick start going.
But overall, it's going to be rooted
in either vs code or Azure Data Studio.
If you grab the SQL projects extension there,
now you've got that publish option to
set up a new container to develop locally.
You don't have to have one already waiting for you.
>> Nice. Then just one quick question.
Let's say I use VS Code all the time.
Do I have to use Azure studio?
Do I have to use VS Code, doesn't matter?
>> You can use either of them both VS Code and Azure Data Studio.
I'm back into VS Code now.
I've got a SQL projects extension for
a database projects in
VS Code where I could be doing this as well.
You'd have the ability to say I want to start
a new Azure SQL database project from VS Code as well.
>> Awesome. You're great. Well,
Drew, I think folks are ready to get started.
Any final tips or tricks or things we miss your Azure folks now?
>> I want people to know that you've got a lot of
flexibility when it comes for developing with Azure SQL database,
you can absolutely be connecting to
those great serverless instances for development as well.
But if you give containers a try,
that'll give you some more flexibility for
how you integrate with CICD.
Then just develop open it.
>> Awesome. Cool. I love it.
Well, Drew, thanks so much for coming on the show to our viewers.
Check the description for some of the links
for getting started with this, like Drew mentioned.
Also, leave us a comment and let us know what
you think about this new advancement if you like it,
if you want to see more things like it,
anything like that Stratechery channel.
We hope see you next time on Data Exposed.
[MUSIC]