Title: Github Copilot in Azure Data Studio
Maverick & Iceman were the perfect partners in the sky.
In this session we will have a look at why Azure Data Studio and GitHub Copilot can be your Maverick and Iceman combination to help make your day to day easier and more efficient.
The GitHub Copilot extension in Azure Data Studio is your AI pair programmer to help you be an even bigger rockstar.
We will look at 3 different languages inside of a single tool to show you how to get started.
E hello everyone thanks for joining our second monthly meeting for the DBA virtual User Group before I go further just so you know this meeting is being recorded with a consent from the speakers so uh whatever you put in the chat that will be recorded and if you do
Not want it either you do not type in the chat or you can exit the meeting right now uh so we have a Twitter handle our website I’m sure you all of you know about these things that’s why you signed up for this meeting and um sorry if you have any suggestion to
Speak you have a feedback or uh any suggestion for us uh you can always send us an email at dbug outlook.com we do monitor that inbox and we will respond to you uh we do meet twice a month once is a second wedes day and the other one is
Like today which is the fourth wedes day we alternate the times uh for lunch hour between east and west coast to make it fair to our friends on the west coast um if the speakers give us permission we do record our meetings and we have a YouTube channel uh in if you
Go to YouTube search for DB vug or go to this URL or scan the QR code uh you will be able to get this recording which will be uploaded and our previous all the meetings and the future ones that we get permission from the speakers these are some of the sessions
That are um scheduled that are coming up uh we pretty much book till end of the year uh the most exciting part is starting in March till May we are doing a six-part series uh gear towards skills required to be a cloud DBS so if you’re
Working on on premises if you’re new U you know or senior level but you are thinking to go to Cloud uh this series will be very beneficial for you so it’s starting in March it goes till end of uh you know end of May uh we have six different speakers we’re talking about
Six different topics uh and the skills that you can acquire um you know you need and what you can use what you know today uh what are the new things you need to know and then you know you can start working in in cloud and there are some other
Speakers also some Microsoft uh product teams uh some of the members will be coming know towards this Q3 and Q4 and speak on different topics these are some of the other community events some of these are a one day long event on Saturdays they are
Free of cost some are paid like SQL bits is happening pretty soon it’s in London there is a vs live in Las Vegas and then pass data Community Summit has been announced which will be in the November uh 4th so uh take a look at those if you
Go to s.com or dater.com you can get more details and we want to thank Warick for taking his time it’s early morning in Australia he’s joining all the way from there to help us uh learn about GitHub copilot so I will keep quiet I’ll stop sharing and hand over to war week
Just a few Logistics if you have questions comments uh I know you cannot unmute put in the chat and U war will answer those we’ll end the meeting sharp at the hour because it’s a business hour but if wari has time he will entertain you know remaining questions or comments
At the end War take it over let me know when you can see the um slid okay just bring that up so that I can see the chat window over here okay well thank you everybody for coming along to my session today your user group or your virtual user
Group on GitHub copilot in asada studio if you do see me looking over to this side it’s because I’ve shifted the uh uh teams view over onto another screen so that I can keep an eye on your questions in the chat window so come on there we go for those of you
Who don’t know me my name is war grud I’m data platform MVP yes I’m getting old uh and I used to love going snowboarding but over the last couple of years I haven’t had that opportunity now the most important parts about this slide are let me just highlight them contact details okay feel
Free to reach out to me about any questions you have about this session or uh anything in the data platform that you may have questions for so what are we here talk about so here’s the abstract for today’s session now I’m not going to go through that abstract hopefully you’ve had the
Opportunity to uh have a look at the abstract and that’s why you’ve joined us today for this session but I do want to take you on a little bit of a journey um to show you what the uh perfect Partners could be with you using Azure data
Studio and GitHub co-pilot to allow you to become even bigger rock stars in your workplace so with that let’s go ahead and get started so what are we going to be using one as a data studio now because we are data professionals um we are going to be using SQL server but
We’re going to be using some other tools as well but why Azure data Studio well with the release of SQL Server 2017 where we got um support on uh Linux we needed some way to be able to manage and maintain that or if you happen to be one
Of those lucky people early on that uh worked in an environment that allowed you to bring your own device and you happen to work on a Mac for example it was difficult for you to be able to manage and maintain your environment because management Studio only worked on
A Windows environment Azure data Studio takes that even further uh allowing us to be able to work on whatever platform we want and the beauty of that is that we can pick and choose what we want to do based on our job roles and we do that with extension
Now uh this session is no different with that we’re actually going to be looking at the GitHub co-pilot extension so what is GitHub co-pilot if we’re wanting to know more information about it we can go to this URL and let me just uh paste that into the chat
Hopefully uh it’s not going to let me from there I’ll do it later um but we can go to this URL to find out more information about GitHub code pilot but what is it well it’s an AI powered P programmer that can assist you with code compilations or code completions I
Should say now that might sound a little bit like in t sense so for those of you who are used to working inside of um management studio and you happen to be using uh redgates Intellis sense they help you uh create your statements a whole lot quicker okay because uh you
Can have things preed and the same in Azure dat Studio we’ve had that for a while where um it assists us with typing but the code completions go even further what GitHub co-pilot also gives us is um suggestions what do we think it could be but taking that even further it gives us
Entire code Snippets and in the upcoming demo because the majority of this session today is going to be spent inside of a data Studio where we will be looking at GitHub co-pilot so it is taking intellisense but it’s a whole lot more to make our lives a whole lot easier now it was
Developed in combination between Microsoft and open Ai and personally I think it’s a great tool for uh training so if you’re a new starter to working in the data industry uh there’s a load of different um languages syntax that you need to learn okay this is a great way for you to be
Able to start that learning process or if you happen to be old like me and you forget uh you know what is that syntax it helps you out and we’ll see what that looks like in the upcoming demo now one of the questions that I have had
With this is if we are using GitHub co-pilot is my environment is my data safe well yes Microsoft have come out and stated this publicly what it doesn’t do it does not interrogate your database now when I first started using GitHub copilot I thought great I can use this point it at
My database interrogate it from a consultant’s point of view to be able to say okay tell me about this store procedure tell me about this function and it would just go and do it no it doesn’t have that ability to uh go and look at your database interrogate your
Database it doesn’t pull out any of that data and it doesn’t go and put it out on the uh web for other people to gain access to it for you to be able to use um GitHub co-pilot there are some things that you need to know one we need Azure data
Studio but we do need to have uh a certain version of azure data studio if you’re just starting to have a look at it and you’re downloading Azure data stud Studio as out right now then you’re able to use that with uh this extension without any problems at all you do need
To have an internet connection and we’ll see what that looks like uh when we hop into the demo you will also need a uh GitHub co-pilot account now you may already have a GitHub account a GitHub co-pilot account is different okay so you need to sign up for that um and
You’ve got a couple of options you can start off with a 30-day free trial account to have a play with GitHub co-pilot you can then either choose to have a individual account which will cost you about 10 bucks a month or if you want to pay up front 100 bucks for
The year now as an MVP I actually get access to that but before we even found out about that I’d gone and paid for that and so I’m actually paying the subscription up front so that’s how much I like GitHub Copart the third one is from a business
Point of view okay and this is 19 bucks a month per user so in today’s session given that we are uh data platform professionals I’m going to focus on a couple of languages and so those three languages that we’re going to have a look at given we are data platform professionals tsql because
Depending on what we do in our jobs we’re likely going to be spending a lot of time in tsql you may or may not be using using Powershell and for those of you who are um a little bit more adventurous well more adventurous than me anyway depending on what you’re doing
Uh you might also be using um python now the beauty of all three of these languages I can uh work in these all inside of azure data Studio without having to jump out to some other tool so you are are you ready to have a look at
Uh how we can access all three of these and GitHub co-pilot to uh find out more about what this can do to help you so let’s dive into the demo now before we start how many people can I get some hands up how many people are already using Azure data
Studio give you a little bit of time to okay so we got a couple of people get some more people that’s excellent so for those of you who already are using Azure data Studio that’s fantastic so you’re you’re already aware of uh what it is
For those of you who aren’t now as I mentioned it’s a tool that allows us to manage and maintain our uh data environments regardless of the platform that we’re on for you to be able to get it it’s nice and easy go to your browser of choice and type in Azure data Studio
Download the other thing you may or may not be aware when you go and download the uh latest version of management Studio Azure data studio is included in that download So once you’ve installed it and the first time you start you’ll be greeted by the uh welcome screen that
We can see up here now one of the things that I like about Azure data studio is its ability for me to be able to easily change things now you can see here I’ve got it running in the dark theme because I prefer to use that now I’ve left that
In this dark theme because I wanted to show you how easy it is for us to be able to change now for um uh presentations Etc dark themes not always the best for uh every end user so we’re going to just change this back so we can
Come down here to the color theme and we’re going to choose the normal light theme and you can see very quickly I’ve been able to change it for everything inside of azure data Studio a whole lot easier than what we’ve got in management studio now the other thing the font at
The moment might be a bit small for you okay can I get some hands up to say if uh you would like this font to be bigger yes okay so to make it bigger it’s as simple as this of just with a shortcut key okay I can make this um a
Whole lot bigger is that better so we got a few people so because I’m easily able to change that right I can make it more suitable for all of you on this call now from an extensions point of view it’s easy for us to get the extensions so we come down here to
Our extensions and we just need to do what uh there we go co-pilot and we can say GitHub co-pilot by clicking on that we can already see that I’ve got it installed okay what it gives us some information about what is GitHub co-pilot okay now now if you happen to
Work in an environment where you’re not able to just download software onto your workstations um because of security reasons you can give Azure dat Studio to your uh security team they’re able to then um approve that and put it into a secure location that you’re able to get
That the same with the extensions excuse me you can download those extensions give them off they can be approved and you’re then able to install them once you’ve got it installed and we’ll just get rid of that we can see down here in the bottom we’ve actually got our GitHub
Co-pilot activated okay I can deactivate uh that co-pilot so that therefore I’m I’m not using it during uh anytime I’m working inside of azure data studio now what you will notice um as we go through when it starts to have a look at things our GitHub co-pilot will um he’ll start
To think about well am I doing something and that’s where he’s going out and connecting to um the big bad wide world of the internet okay if we don’t have uh any internet connectivity and we’ve got GitHub co-pilot connected he will just sit here and
Spin okay so just a couple of things to remember from that now for those of you who aren’t familiar one of the beauties of um GitHub co-pilot is uh I shouldn’t say GitHub co-pilot as your data studio is we’ve got the ability to create and work
In notebooks and so for our demo because it works really really well for demos is having notebooks and so I’ve got three notebooks open now a notebook is just a way for us to be able to um combine we can combine text as we can see at the
Top we can combine images and we’re able to combine actual code so we’ve got code blocks and we’ll start to work through those so we can see here that uh I’m connected to SQL server and I’m connected to the wide world importers database on my local 2022 instance on my
Laptop so no big deal we mentioned about some of the prerequisites that we need um version 1.44 or higher I’m actually running at a higher one so what are we at right now 47 okay so it’s been out a while uh we need the extension we’ve
Shown how we’re able to get that uh our GitHub co-pilot account and our internet connection now with your um GitHub co-pilot account the first time you install the extension it will ask you to um put in that co-pilot um account okay because you’ll be asked to log in it’ll
Have a popup screen and it’ll take you out to uh the GitHub co-pilot uh URL for you to be able to log into your account it validates that and then Associates that with your um Azure data studio uh environment okay once we’ve got that we’re good to go now I mentioned that I
Think this is a really good tool for uh new starters to be able to learn things or uh if you need a refresher because we all know things change very very frequently in our line of work so there may be new features depending on what version of SQL servey you’re working in
That you may not know about and we’ll have a look at some of those throughout the demo but uh we could learn new new languages which is why we’ll have a look at Powershell and uh python now throughout this the big thing that I want to try and get you to take away
From this session is not that we can write code but to get you thinking about how can Azure data Studio be uh used for you in your environment to make your life a whole lot easier okay so just because I’ve got something up on the screen doesn’t mean um that’s the end of
It if you’re thinking about what about this okay and if you’ve got any questions at all put them in the chat okay um because if we make this as interactive as possible then it’s a better experience for you so one of the first times that I delivered this session we actually went
Into a um uh a a lot of discussion and we tried things because we said oh what about X Y and Z okay and that’s the beauty of this I can just put them straight into the demo and we can see what those results look like okay so don’t be
Afraid uh okay we won’t worry about that that’s about the recording T will take care of that so don’t be afraid to put your hand up to ask any questions uh we’ve got those being monitored and every now and again I’ll have a look over to the
Site so what do we need well to help us out we need to have uh some form of um uh commentary that is going to be used okay so we can see here that I’ve started off and I’ve just made it nice and simple um with using a block comment
Okay you can use your inline comments it doesn’t matter now for this to all work as I mentioned it doesn’t go and interrogate our database it goes out and it’s looking at um the billions and billions of lines of code public lines of code that GitHub co-pilot has been trained across okay
Now because I am using the wide world importers database some of the recommendations or suggestions you may have already seen because you know it’s a great demo database and you’re saying to yourself well how’s that going to help me with my environment if I’ve got specific code well GitHub copilot’s very contextually
Aware okay so yes it’s going to go out and have a look at what’s available from code Snippets and samples Etc out there on the web but also depending on what you’ve got open so if you were using um Source control uh in your environment for data
Uh platforms so you’ll have a remote repository that might be using um GitHub itself it might be using Azure data studio um um Azure devops I should say not Azure data studio uh it doesn’t matter but you’re going to have a local repo that you might be working on now
Inside of azure data Studio One of the benefits that we do have is that we’ve got built-in Source control and we can see that by this little icon here and if I open up that um uh folder that we’ve got our local repo on okay by just coming into our source control and
Saying open folder that will then have the code base for our environment open and available to Azure data studio right because we’ve got the we’ve got access to those files we’re not accessing the uh the the data but we’re just accessing our uh store procedures functions views tables
Whatever that happens to be so then that’s now inside of that contextual awareness when we start to have a look at it that’s going to be able to be looked at and used okay and so that was one thing that we came up with in an earlier session on
What about this so that’s why I’m saying have you thinking caps on if you’ve got anything you want to try we can try I can’t guarantee it’ll work but we’ll give it a try so how do we get started as I mentioned we’ve got these um uh a
Statement here and we’re just saying give me a statement to display the sales. customer categories okay very very simple so what do we do underneath we’re just hitting enter and it’s going away and giving us here is a sample of what it thinks that statement could look
Like so with hit and then we can hit tab to be able to accept that now one of the downsides is at the moment any um results that we do accept we always get on the line directly after is those um um three little characters which are
Going to excuse me which are going to uh throw an error inside of SQL Server because they’ve got nothing to do with tsql or any of the languages that we’re having a look at today okay so nice and simple we’ve got that uh that one statement with two keys and it’s gone
Off and hit our database and we’re able to get that okay so uh very simply we’re able to uh retrieve that now the difference where I said about Intellis sense okay if I do the same thing again if I go we just so here’s our Intellis sense where
I’ve started typing select and it’s showing me I can that select once I’ve hit the tab button to accept that GitHub co-pilot has also kicked in and I can hit tab again and there’s that same statement okay so this is where it takes us from that intellisense side of things
Takes it even further and gives us those recommendations so we’ve created our first statement very simple statement we’re wanting to create a statement but we’re wanting to be able to um fill filter the data that we’re we’re retrieving okay because we don’t want to always return every single piece
Of data so we’re building uh our way through what type of statements are we able to use so once again hitting our Enter key we’re able to um select tab and select everything and inside of that uh two key strokes it’s now given us our statement with our wear Clause to be
Able to filter our data gives us our one row of data we want to take it a little bit further we’re explicitly giving it um the table name a couple of columns um and we’re saying we’re wanting to filter because we’re saying customer category name inside of these type of values and we
Want to do some ordering nice and simple a couple of keystrokes and what’s it giving us there we go and our order bite so very simply in a couple of keystrokes we’ve been able to go from a simple select statement to a little bit more complex where we’ve got
Filtering but we’re also sorting our results set and there’s our our results that’s nice and easy for us to come back to I’m not going to run this next one uh because all we’re doing here is we’re just explaining or picking explicit columns okay which is what we should be
Doing instead of I come back to our first one and we first two where we’re using the select star okay I’m not condoning using select star in any ways shape or form but from a demo point of view showing you how this can help you
Get started and then we start to move on from there but the same thing this will go and just give us those particular ones okay um we’re needing to join two different tables well what does that look like for us once again we just going to hit our
Enter we’ve selected we’re giving it our um col or our table we’ve got our join what’s it joining on our category ID and we’ve got our order by statements so we’re able to take that a little bit further and join multiple tables is it correct there we go we’ve
Got 51 rows of data job done take that a little bit further now this is where I was saying uh we may have a uh feature that we may not be fully aware of we may have heard of this thing called first value now unfortunately because of the syntax with
First value and last value we do need to know a little bit more about it and we did try and um uh play with how much data or detail did I need to give in the comment section for GitHub co-pilot to be able to return things and I guess
Unfortunately with all of the uh data that this has been modeled over or trained over I should say that these types of features are not potentially uh used all that often Okay so we’ve got to give a little bit more detail so it might not be um the best one for us to
Be able to use on showing what we can get but the whole thing about this is to show you going from simple to more complex on working in our environments so if we hit so there’s our entire Block in one go okay so it has formatted it correctly
But we’ve had to give it everything that we want we got we there were some things we didn’t give it so we didn’t tell it that we needed to petition by we’ve just said um of Auto date over city name okay so yeah the first value of the
Order date over the city name and we want to order by the city name and we’re giving it an alas so it’s gone and added a little bit extra to it for us but we still needed to know a little bit about that for me to be able to um put the the
Statement together we do all of our joins what are we joining on so multiples and we get our 146 rows back with uh what that statement is returning to us now window functions might be something that you’re not used to using Okay um and how do you actually go about
Creating those so a little bit different to the the statement just before I’ve gone and just said give me a window function as row number so what does that actually give us on top of all of our other joins and we’re saying that you
Know what do we want we want to some so we want to do some aggregation of some form uh on those uh columns and we want to limit it to Cherry Grove Beach okay yes we’ve got some aliases so it goes and gets us all of that and here’s our window
Function okay so we just said give me a window function as row number and it’s gone and created that here’s the syntax is that the column that we’re wanting it over maybe maybe not we’re able to change that okay but it’s given us what that function looks like
Oops we go through and it should create all of our joins and it’s giv us back the uh Group by which we need because we’re using all of those aggregations where we didn’t even ask for that okay we said yes give me an order by but it’s helped us in
Going and saying right you’ve got these aggregations we’re creating a window function oh you need to have a group BU as well now one of the things that we will have a look at um with the uh um demos that we’ll have a look at for both Powershell and um
Python is that we need to take whatever results are that it gives us we need to verify those are they correct are they what they’re wanting at the moment I’m not too concerned about that because I’m pretty familiar with the um tsql that we’re uh trying to create okay but if
We’re new and that’s why I’ve Incorporated Powershell and python what do we need to consider with the results that are being returned now one of the things that you will have noticed as we’ve been cycling through each of these um uh scenarios which are adding more and more features
Or changing the complexity that is being uh created is that excuse me um I’m literally hitting the tab uh key to accept whatever it’s returning what we do have is if there’s multiple uh recommendations that we can Cho choose from we’re able to cycle through and choose those recommendations
And we can see here that we’re able to do that with the ALT key and we can while I’m only displaying the open square brackets that will cycle us to the right if we use the um closed square brackets it’ll cycle us through to the left so we’re able to choose is this
What we’re wanting so what does that look like for us so we go hit our enter we’ve got our select from now it’s given us a subquery because we’re we’re looking at creating a pivot table so if I go uh alt on this one let’s just go
Back so on here I haven’t accepted anything and it started to uh give me some recommendations so if I go Alt it’s showing us two recommendations that uh we can choose but it hasn’t given us the full block or has it let me scroll down oh
Okay there we go it’s got our full block and if I put the mouse cursor over it we you can see we’ve got two um recommendations that we can use and I can either accept it here or by hitting the um alt plus it’s taken us
Back to just the single um Open brackets so we want our full block we’re calling it our source table yes we’re wanting to do a pivot and there’s our pivot table that we’re pulling our data from okay now with pivot tables you may not be
Using them on a regular basis but one of the things that you do need to know is your data to be able to get your pivot table to work appropriately and that’s because of how we need to Pivot it on um the accounts person ID okay so without
That information it’s not really going to provide us the um the correct uh Syntax for our our statement okay and that’s because when we run that we can see yes we’ve got a a bucket load of data um that has been returned from our pivot and uh our um IDs are
Across the top that we’re we’re using and we can see that they’re associated with these particular invoices okay so some of it you need to know your data and that’s what uh we do as data professionals is that we do need to know the data that we are working on but
Co-pilot is going to be able to assist us in the type of um statements that we are creating or writing have we got any questions okay can it do something like statement to show me the statistics update date for the indexes on customers table very good question Jesse let’s
Have a look so if I just so if we go in here I’ll go add let’s add a code cell and um let’s have a look see what it got comes back wellow the PG stat users table is not one of ours so one of the things we can do and
Is it down further no it’s next so but if I go so I’ve hit control enter and okay we haven’t seen this today and I wasn’t going to be showing this until we moved over onto uh the Powershell one but for our statement if I hit the control enter
It opens up the GitHub co-pilot pane on the right hand side uh and gives us um uh a whole lot more options as we can see here hand different solutions that we’re able to choose from so on that note that’s not going to be any good to us
Constraints okay so it looks like um unfortunately based on the question we’ve asked it’s not giving us any recommendation on how we’re able to pull that information and I guess that’s the beauty of that that based on um um uh the type of information or the question that we ask
Is what it’s going to interpret that now there’s there is no right or wrong way on what you need to add into this comment section to go this is what I want you to help me with okay because depending on where we’re from the language that we uh used
To working in Now language I’m talking about the spoken language so I work in English okay if you happen to be working in uh Spanish or French or German or Russian for example the way that you ask your questions is going to be slightly different to how I’m asking those
Questions in English Okay and the type of words that you would have in those so it is just a case of you playing with what you want to enter into uh that comment block for the question that you’re asking to try and go is this giving me the correct answer that I’m
Looking for okay so while thank you Jesse for um putting that in and we we gave it a try and and unfortunately I didn’t get the result that you wanted but as you said yes it started to look at those system tables they just weren’t the right system tables for us to get
That answer okay but that’s fantastic that’s the type of thing that um I was hoping that people would start to think about and go well how do I make this work okay now I used to have this one in here and for the last couple of sessions for
Whatever reason things have changed and it’s no longer creating the um create table statement and I and I was playing with it to try and get it to create it so I’ll skip that section but it normally led into this next one where I’m saying I want to create a stored procedure to
Populate the table that I’d created in the previous um cell okay and we can quickly and easily see that uh it’s gone and created uh that whole statement for us and uh it’s throwing an error okay because it’s saying well hey these don’t exist because no I haven’t created
Created that table but we can see that uh it’s allowed us to be able to go and create that store procedure so we’ve um moved from being able to write a single statement using some complex tsql statements to creating a um store procedure the same is with a uh a
Function now we’ve got many functions uh available to us inside of tsql so what are we wanting so I’ve said Okay I want a table valued function um what does that syntax look like very quickly just with a couple of keystrokes I’m able to get here’s my
Table and there we go okay so from the sales category with a couple of keystrokes I’ve been able to get uh 11 lines of code that’s gone and created that table valued function for us and this is just my clean up so make sure that I go and clean things up at
The end so before we dive across to have a quick look at Powershell as well as some python any other questions around uh the tsql side of things or some anything else that you would prefer to have a quick look at before we quickly um jump across okay so let’s have a look
At for a Powershell point of view now if you’re not already using Powershell and you’re wanting to start to learn Powershell um a your data studio in conjunction with co-pilot can get you started okay so with um we can see here that I’ve got a Powershell section and
That’s because once again there’s an extension a Powershell extension and if I just open that up what this will return and show here is a massive list so starting at a and I’ll just quickly scroll down as you can see there’s loads of them there is a bucket load of um
Powershell commandlets available that you’re able to then um look and learn and so we could say uninstall script for example well what is that and here we go we’ve got get help so we can go control F1 um or we can actually uh create that or insert that command into uh a code
Block that we’re working on okay so a great way for you to be able to start and learn what is it that I’m I’m wanting to know about so taking that further so as you can see we’ve jumped from one workbook uh notebook to another notebook and the
Kernel for quickly show we’ve gone from in here it knows this is a SQL kernel and we’re running tsql code we come across to our um our second uh notebook and we’re running in Powershell so same thing we have our code block and we can see our code block is a slightly
Different syntax because it’s a different language but I want to be able to say okay give me how do I connect to my SQL Server instance from Powershell and I want to get a list of um uh all of the databases and I display all of those databases and give me a
Time of how long that took to execute Etc so like I did before if we go control enter so we’re showing that it’s going away in thinking and we can see down here that our co-pilot was thinking away and it’s come back with a number of solutions that we’re able to then choose
From and so we can have a look at those if I just expand this out so that we’re able to see it a bit better so what have we got well we’ve got some uh parameters we’re wanting to connect to our local instance there’s our database okay we
Want to get our start time it’s created a connection string for us using our um parameters that we’re set okay we’re going to use Integrated Security go and umate create our connection put it all together open that connection okay so we’re then generating our Command and our Command is going to
Be okay select name from CIS databases because we did ask for uh all of those databases execute that so therefore it’s going to place that result set into a reader Loop through that and we’re going to Output what that looks like close our connections get our end time work out
Our duration and um display that okay that’s potentially uh going to give us exactly what we’ve asked for okay as I scroll down we can see some not so good um recommendations on what it’s provided slightly different to uh how we’re doing it it’s saying okay user invoke equl
Command that might be correct it might not be it might be what we’re wanting to use this is where I was saying uh a couple of minutes ago about with the results that we are getting from here we do need to verify those and not just accept this is the
Correct outcome or the correct result uh that we’re needing to use so if we take a copy of that one and just do a quick test we can paste it over into here here I’ll just give ourselves that little bit of extra real estate and if I execute that tab off we
Go did you work there’s our outcome okay so it’s given us a list of uh what our databas is and what our duration was so okay it it did work okay and that took you know 0. one of a second for it to return that if we were to then take
Our uh second one and we were to replace that same thing and it actually took less time for us to be able to to do that and it’s less code okay but very quickly um with being able to get some uh Powershell code put that in I know it’s
A arbitrary thing because we’re just connecting to a SQL instance inside of a uh um Azure data Studio and and it’s just returned that list which we could easily get from inside of running a tsql statement but um this is just to show you how it can assist in learning about uh those
Powershell statements now what have we got uh interrogate the DB but we can explicitly extract some metad data as an extra step to help it and provide more context do you think that optional interrogation may be added at some point good question so uh your statement about yes you can explicitly extract
Some metadata so the ddl that’s where I was saying that if you’ve got that ddl in your Source control and your local repository and you open that local repository in here then you’ve got that ddl code available for you that is contextual for you to be able to use okay
Do I think that they’re going to add the ability for it to for you to say point at my database and interrogate it I think there could be a lot of legal mind fields and challenges Etc there um so whether it does come about I don’t
Know uh right at this point I would probably say not in the foreseeable future but we just have to keep an eye on things on uh that’s looking so 10 minutes just soon no no problems so in our tsql code we um created a function now if you’re new to uh
Powershell and you can see here I’m saying create function get server name okay in Powershell the a function while it’s called the same is slightly different to what we would uh expect to see inside of tsql code so um you know you may hear it bandied around or when
You’re starting your uh work with Powershell and you go what’s this function thing so that’s why I’ve just included it here so we’re just saying give me a a function to be able to do what we wanted to do okay and so we can see here now I did that inside of a
Single um enter command but what it’s doing so we saying function we’re passing in a parameter our server name and we want to split out and say we want um what is the server name in This Server instance so we’re just doing this is um just what we’re passing in looking to
See if we’ve got a a backslash to differentiate between our server name instance name you may want to put uh a little bit more coding around this okay but this was just to show you uh the difference just by using that same um uh same name function and we’ve
Done it differently between tsql and Powershell now just to finish off python now uh there may be people in in here that uh have a whole lot more python experience than me and that’s completely fine my extent with python is purely putting this uh demo together to
Be able to show well can GitHub co-pilot help me learn inside of azure data Studio we’ve got the ability to um run python so we can see here our kernel has changed we’re running python on um some of the things that we do need to know
About we need to have a couple of packages in place our piot BC and our panders if they’re not in place we can come up here and we’re able to just manage what’s in place in our environment and if uh uh we needed to go
And add something new we can or uh if we scroll down there’s our pandas and there’s our p80 BC so we’re already in place we’re good to go on being able to do that so same thing create a connection string uh to connect to our um SQL
Database and return a list of um data from our sales. customer categories which we already created the same thing in um uh tsql but anything more for me no other question yet so okay so hopefully let’s see if this works for us and there we go so uh without knowing
A whole lot about um uh python I’ve been able to create a uh a statement that goes and connects to my local instance of SQL server and uh pullback details around um the sales. customer categories and there’s our results okay so with that we’ve got a
Couple of minutes left that’s the end of our demo so we’ll quickly come back to our slide deck so in summary what have we gone through well we’ve had a look at what is GitHub co-pilot so it’s an P programmer uh developed in combination between Microsoft and open AI that is able to
Assist you in um in my opinion learning new languages or assisting you in your uh existing workload to be able to write code faster which I’ve found I’ve later been spending more time in in Powershell and with the type of code that I’ve had open uh as I’ve working through it’s
Thinking about um the contextual side of things because so I’ve got multiple Powershell scripts that are included and I’m needing to call them and it’s just making my life a whole lot easier with being able to develop a whole lot quicker we had a quick look on how do we
Get GitHub co-pilot well we get ourselves a GitHub co-pilot account we uh install the extension inside of azure dat studio and we link our GitHub co-pilot account to Azure dat studio for us to then start to be able to use it and we’ve just been through the predominant uh time of the session
Looking at uh tsql Powershell and ring rounding out with python okay so with that a big thank you all for coming along I know we’ve got five minutes left so I’m happy to uh open that up for questions and as um taob did mention at
The uh top of the hour at the start of the session uh I am happy to stay around for a little bit longer after the uh uh top of the hour to answer any further questions if you have any so with that I’ll hand back to T and uh pesh and if
There are questions then I will I will let too finish his TS and then I have a couple of questions after that so I I’m willing to stick around yeah I just going to answer the logistical questions that someone asked yes recording will be uploaded so subscribe to our DBA vug channel in
YouTube and I will uh try to upload this by this weekend we always try to get it done it’s a volunteer work and um uh wari did you see vams question uh others I can read it loud uh are you meaning the the one around the uh optional interrogation T
Yeah yeah yeah yeah yeah so I I did answer that in that okay um while and I’ll I’ll just recap for uh for those that if you did miss it um so yes explicitly extracting metadata um one of the easiest ways is if you do have your uh database
Environment in Source control and you open your local repository inside of um Azure data studio so if we come back into Azure dat studio just to answer that once again uh if we come to the extensions and I’ll just change that and we go oh we don’t need um I don’t need it
It’s not a an extension Source control is built in by default in Azure data Studio but what we do are able to do is that so yes you you’re able to easily clone your um remote repo locally or if you’ve already done that we’re able to then say open navigate to that location
Select folder and that will open that um source that local repo for you and so uh that repo will probably be broken down into a folder structure you know you may do it by uh schema object for example okay but all of that code is available to you you’ve got that folder open
Inside of azure data studio and so that there becomes contextually aware because you’ve got it open so therefore when you’re writing your uh your comment blocks to say well what am I doing it’s able to use that contextual um reference to that ddl code it’s not interrogating your database
It’s a file okay because that’s where you’ve got that ddl located Okay so that makes that a whole lot easier the second part about the uh optional DB interrogation I don’t think that will happen in the near future I’m not saying it might happen in the distant future um
That’s something that’s well outside of uh my purview of um well will that happen or or not happen so yeah just a comment if I may add one if you allow me so I have seen you know by I don’t remember uh you know who was showing
This to us if you do not have in Source control say if you’re trying to work with two or three tables if you open another uh file within the a data studio and just script out the object definition um the co-pilot was able to interrogate those to get the right
Column name I have seen that uh and and I’ve tried this that works just just a comment otherwise uh I let paresh ask question but thank you very much I actually noticed your prompts are a lot more disciplined and lot detailed than than me that’s why your output is better
So you know that’s another comment that I always make the better your output your your prompts are the better you’re going to get good so you are very organized compared to me so that’s what something that I learned from your demo today that I need to get better in my
Comments so that took that took me a little bit of taon tail because uh when you’re put as you would as you would understand when you’re starting to put together a demonstration for people to be able to see um when I first started playing with that like you just
Said the detail that I put in was very limited and therefore the results I was getting was also limited and a little bit frustrating going why is this not working okay okay so that’s that learning curve that I had to go through on understanding well how much detail do
I need to put in to get the level of assistance that I want and from that I have had comments about on the flip side are but that’s a lot of detail that you’re putting in to be able to get this like why don’t you just write the code
Well you might not you might not know that code and I guess the beauty of that is there are business people that work closely with technical people I’m assuming majority of people on on uh this call are technical people but there’s business people who work very closely with technical people who do not
Know the ins and outs of the technical language but they know the data very very well and so they could use this because they can write in planning English I’m going to use it because that’s my natural language but in inside of azure dat studio in that comment
Block they could type plain English to assist them with well I want this statement to pull this data I know what data I’m pulling but I don’t know how to write that so they’re going to probably write a whole lot more detail than you and I would does that make sense and and
Conversely changing that to whatever your natural language is that you work in okay absolutely so yeah Parish go ahead uh thank you again you know if I don’t speak again but uh I’ll let if or has time if others have question put in the chat and then war will you know is kind
Enough to answer those so it was great I mean I learned a lot to be honest with you and and thank you again oh you’re on mute Parish now I’m not okay so thanks to toob man so what happened was that I was absolutely not interested in this topic
And then as it went along I’m like gez why am I not doing this right so what I did was that I opened up my Azure data studio and installed the co-pilot and then it gave me a prompt to kind of register and put in a token and I did
Before I did that it got out of that window and I never got that window to put that token again and I don’t know how to one of the things that I missed earlier part was that how do I actually tell it to use the co-pilot so couple of
Things I can share my screen I think I know you know I let War answer first but I think you you haven’t registered for the copil like War we gave you a couple of options free for 30 days is stent version or if you have it
From your company and if you use the same account it will automatically find it but I’ll let War you know help I see okay yeah so so the first thing you need to do is um as I mentioned you may already have a GitHub account okay which
Is more for your Source control but you need to sign up and register for a GitHub propilot account which is different okay so so you would need to uh in your browser of choice uh if you just put in there GitHub co-pilot sign up then uh it will take you to there and
You’ll be able to then choose what type of account you want okay you could try for free for 30 days okay um or you can then choose to I want to pay for an individual account um or a business account once you’ve got that account then um okay so that looks
Like that looks like you’re so let me just quickly so I was here and it says Okay click here to continue with whatever you want to do and I clicked on that window it gave me an option to put that token here but after that nothing yeah Um I just want to make sure if do others have any question if you have it put in the chat and or we can decide you know maybe answer those quickly and then help out pares I yeah want to respect that people have to go back to work you might
Have meetings and stuff so and if you do not have a question uh okay Howard say try install the extension then install again okay uh if you do not have a question thank you very much I’ll stop the recording here I’ll put it up and then U you know if
Wari send me the notebooks I’ll put it in our uh SharePoint and I can send you the link if you’re interested and U you know thank you again and uh you know keep signing for the future meeting so I’ll stop recording and then if you have
Your question you can still put it here otherwise thank you again thank