>> Learn how to get started with
database projects in Azure Data Studio with Warwick.
This week on Data Exposed MVP Edition.
[MUSIC].
Hi, I'm Anna Hoffman,
and welcome to this episode of Data Exposed MVP Edition.
Today, I'm joined by Warwick,
a member of the SQL community.
Warwick, thanks so much for joining us again on Data Exposed.
>> Thanks for having me back, Anna.
>> Always a pleasure.
Today, we're going to be talking about connecting
the dots for Azure Data Studio with database projects.
This is something I don't know a ton about,
so I'm really looking forward to just sitting
back and watching you put all of the pieces together.
>> No problems. What we'll have a look at today, Anna, is,
as most of our viewers would
know that database code has been around for quite some time,
database projects have been around for
quite some time as well, and Source Control.
But combining those three things together hasn't
always been the simplest and easiest thing to achieve,
especially inside of a single application or tool that's free.
So connecting the dots in
Azure Data Studio with database projects and
Source Control is an intro for our viewers who are wanting
to start their journey on using database code,
database project, and Source
Control all inside of Azure Data Studio.
>> Awesome. It seems like a lot to piece together,
is it going to be really complicated?
>> Not at all, Anna, and that's why we want to take
this intro to start from
the bottom so that people can piece it all together,
follow along with this quick intro
so that they can start their journey.
>> Awesome. Let's do it.
>> Let's have a look at what do we need to start this journey.
Well, first off, as we can see here,
we need Azure Data Studio.
With them having our Source Control,
we need to have Git.
We need to create a local repository as
well as our remote repository so that
we can collaborate with our colleagues.
With that, we've got to use either Azure DevOps or GitHub.
Finally, we need to have,
of course, SQL Server,
whether that be the box product or whether that be
a Cloud version in whatever form that takes.
Let's have a look at the tools that we
need to be able to get started on this journey.
First off, we come to the download page for as Azure Data Studio.
If we scroll down just a little bit,
you can see that based on
the operating system or platform that you're working on,
choose which version of Azure Data Studio you want.
For me, I'm working in Windows,
so that makes it nice and simple.
So that I can have my local repository,
I can come to the Git for Windows
download to get what I need to be able to get started.
Because Azure Data Studio works on both Windows,
Mac OS, or Linux,
we can look at the local repositories exactly the same here,
so we can download Git for
Mac OS by coming to the Mac OS download page,
or we can do exactly the same for Linux and Unix environments.
For our remote repositories,
like we saw, we want to have a look at Azure DevOps.
I've already got a empty repo
pre-created so that we
can look at combining this into our environment.
So that we can see that there's virtually no difference whether
we're using Azure DevOps or whether we're using GitHub,
I've got a [inaudible] GitHub as well.
Now that we've got those things set up and
we've installed Git locally,
the first thing that we need to make sure that we do is
determine where we want that local repository created.
Once we've got that and we start Azure DevOps,
if we jump in and see this,
for those of you who haven't already used it,
there's lots of demos available on
taking you through how to use this tool.
But from our Source Control point of view,
so that we can link our local repository to
our remote repository and
utilize those inside of Azure Data Studio,
it's nice and simple;
we come to the "Source Control" tab and we go "Clone Repository".
If we duck out to our Azure DevOps,
we'll be able to clone the URL,
or the [inaudible] repository,
come back to Azure Data Studio.
It will ask us where do we want that to be located.
We need to navigate to our local repository.
For me, I've go along "C", "Presentations", and "Git repositories".
Select that location.
This will take a little bit of time, not too long
because it's a blank, empty repository.
Once that completes, it will
ask us if we want to open that folder.
We're not going to open that folder
because we're going to clone
a second repository, which is going to
be a GitHub repository to make sure
that we have the same look
and feel regardless of where we're connecting to.
If we copy that code, come back in here.
Once again, it'll ask us to go to the local repository location.
We can see there's
the import project that we literally just cloned.
Same thing, it won't take long for that to complete.
Once again, we won't open when this
finishes because what I want to show you
is if we go open folder
and we open that at the high-level,
we can see all of the repositories that we've got available to us.
It will take us to that local repository, Git Repositories, go.
You will notice that this will cause
a refresh of Azure Data Studio.
That's because it's going away and setting up
the workspace that Source Control will work in.
We'll also use that same workspace when
we're using database projects.
It won't take long and we can see that we're nearly
ready if we just go back to our Source Control.
Now that it's finally open,
we can see the three different repositories
that got available to us.
A tip, if you're wanting to
know whether you're hitting
Azure DevOps or whether you are hitting GitHub,
name your projects in those appropriately
so when you clone them,
we can see that my Create-Project is in
GitHub, as opposed to my Import-Project,
it's in Azure DevOps.
Because the ADS-Demo which was already there,
we can just see that it's called
master and they'll all be the same.
Now that we've got our Source Control available to us,
what we need to have in place so that we can
utilize database projects is that we
come down to our extensions,
and that's the beauty of Azure Data Studio.
Based on what you're wanting to do,
you pick and choose the extensions you need.
So for us, we
just searched for projects and we've got Database Projects.
By clicking on that, it gives you the information that we need.
As you can see, I've already got it installed.
If you didn't, then you'd be
able to just click here and install it,
nice and simple.
These two other extensions that we
do need to be able to start our journey,
and if we look at the SQL Server Dacpac,
we need this extension because database projects uses Dacpacs as
the method of deploying a changes to our destinations.
The third one that we need is a SQL Server Schema Compare.
This allows us to be able to compare what we've
got in our project and what we're going to deploy that to
to make sure that we're
deploying correctly into the correct environment.
Now that we've got those in place,
we're ready to start.
To do that, we come to
our database projects and you
can see there's a couple of options available to us.
One, we can open
an existing project that we may already have created
that's from VS Code or Visual Studio.
Or we can create our own project,
which means that we're creating it from scratch.
Whether it's for a SQL Database, on-premises or Cloud or an Edge,
you choose what you want to do.
The thing that you need to take away from
here is the location that you're
going to store that project,
because if we click on it open,
this is going to make sure that
you place it into your local repository,
ZIP or whatever database code you created is
into your source control and you're able to push that and
committed to Azure DevOps or
to GitHub so that your colleagues have access to that.
Alternatively, we can also
import or create a project directly from a database.
Nice and simple, same options,
but we just connect to an existing database
that we have on an instant,
and we pull all of
those details like we saw before with the create,
we just choose the location for our local repo, job done.
With that quick [inaudible] introduction
into database code, database projects,
Source Control all inside of Azure Data Studio,
I hope this gives you enough information to
start your journey working with
database projects inside of Azure Data Studio. Thanks, Anna.
>> Definitely. Thank so much, Warwick. This is awesome.
What I loved about the demo and
the whole workflow you took us through is,
there were a lot of pieces,
but you took us through breaking them down.
Actually, each piece was quite simple,
it's just a matter of formatting,
setting it up and getting it all configured,
and then you can create and start using database projects.
I also love how you highlighted
the extensions and how extensions make
Azure Data Studio so much better and easier to use
because we have all these different extensions that plugged in.
Thanks so much,
it's been a really great episode,
I learned a ton.
If you have any final tips
or tricks for people who are just getting
started with either Azure Data Studio or database projects.
>> If you're going to start with database projects,
try your first project doing an import.
It'll show you what you get because all you're doing
is connecting to an existing database that is full of code.
You're able to then import that in
and you can start and have a look at what
does it create so that you know
how you can go about starting
your next project starting from scratch.
>> Awesome, I love that tip. Great tip.
Thanks again so much for coming on the show today, Warwick.
To our viewers, thanks for tuning in.
If you like this episode,
go ahead and give it a like.
Leave us a comment and let us know what
you're doing with Azure Data Studio,
Git, and database projects.
We hope to see you next time on Data Exposed.
[MUSIC]