In this post I want to cover using version control with an Azure Data Studio Notebook. Because I thought it would be a good idea to do a crossover of a couple of previous posts.
In addition, whilst doing this I discovered some interesting things along the way that I wanted to share.
Now, in a previous post I experimented with a Windows based Container with SQL Server preinstalled. It was fairly involved and took a while. Which you can read about in detail here.
Whereas in my last post I discussed passing the AZ-400 exam and gaining the DevOps Engineer Expert certification. In addition, I also offered advice for anybody looking to take the exam. You can read my last post in detail here.
With this in mind, I thought it would be good to cover another test which connects these posts together. Which was to add the Jupyter Notebook that I had created in my previous experiment post to version control in Azure DevOps.
Before I go any further, if anybody wants to find out more about Azure Data Studio before reading this post, feel free to read my earlier posts about it.
In order to do this, I first created a new Git Repository in Azure DevOps. Afterwards, I created a new folder on my laptop and created a new repository on there. I then synced up the repositories to get started.
Once that was done I saved the notebook that I had previously created as part of my Windows based container experiment to the location of the new repository. Once that was done I added it to the local Git repository and synced it with Azure DevOps.
From there I went into the new repository in Azure DevOps so that I could look at the file. I wondered if there were any extensions which would allow me to run the cells.
However, instead of finding any extensions to help with me with that I discovered something else which was good.
Jupyter Notebook Renderer
Which was an extension which renders Jupyter Notebooks. Or, to put it another way, an extension which allows you to view the notebooks better within Azure DevOps.
Of course, I had to test this to check if it worked OK. So, I installed it. Afterwards I went to check the Notebook within Azure Repos and saw the raw contents again.
However, from there I discovered two things.
First of all, when I clicked on the newly created Preview tab I was able to view a nicely rendered Notebook. Now, it’s worth noting here this only allows you to view the Notebook within Azure Repos. So, don’t expect to be able to run any cells within it.
Second thing I noticed was that I password I entered in manually might have been secure in the cell I entered it in for the Notebook, but definitely was not secured the results of another cell further down the line.
At first I thought this was just due to me running it manually instead of using it straight from the wizard. However, I double checked by running the wizard again and it is there to view.
With this in mind, make sure you check your notebooks for sensitive data before adding them to version control. Especially if you run the cells before saving the file because those results will also be saved.
You can read more about the Jupyter Notebook Renderer extension for Azure DevOps in detail here.
Editing in Azure DevOps
After testing this I thought I would edit the notebook within Azure DevOps to check it still worked in Azure Data Studio. So, I made a minor change and clicked the Preview tab again to check the rendered notebook. All appeared well.
Due to it being well I synced it with my local Git repository. Afterwards, I opened up the Notebook in Azure Data Studio again and clicked all the cells to install a Windows based container with SQL Server installed. Which all worked just fine.
I hope my post about using version control with an Azure Data Studio Notebook has given you some food for thought.
I think this is a really good way to share your Notebooks with others. However, bear in mind to check you are not sharing anything sensitive like SQL Server passwords.
If others have done something similar with Notebooks feel free to leave a comment below.
[…] I looked at the ‘Resolved bugs and issues’ list this month to see if the password issue I had identified in an old post about using version control with notebooks was on there. Which you can read in detail here. […]
[…] In fact, at one stage I also figured out how you could render Notebooks in Azure DevOps. So that you can view them in Azure DevOps itself. I shared it rather excitedly with my co-presenter. Afterwards, I shared it with the rest of the Data Platform community in another blog post here. […]