Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating an Azure SQL Notebook for Best Practice Checks from the same script for the stored procedure #178

Merged
merged 36 commits into from
Dec 4, 2019

Conversation

SQLDBAWithABeard
Copy link
Contributor

@SQLDBAWithABeard SQLDBAWithABeard commented Dec 4, 2019

I have tried to do something that may or may not be the best way to do this. As such I am happy if this PR gets refused or if others wish to work on it that would be excellent as well.

I have altered the stored procedure in such a way that whilst it is still doing exactly the same (in my testing) the PowerShell command will use the same file to create a SQL Notebook for the code

This has required using tables in tempdb and ensuring that the different checks are split by 128 '-'

I did it this way so that there is only one piece of code to be maintained. I'm not sure if it is the best way forward, thats for others to decide.

The sql files creates the stored procedure as before.

The PowerShell file requires the ADSNotebook module which can be installed with

Install-Module ADSNotebook -Scope CurrentUser

It should be run from the root of the repository and it will use the SQL File to create the notebook and save it and open it in Azure Data Studio

It includes some information at the top

image

and some instructions

image

Every cell is created minimised and there is a bunch of code at the top of each cell to make everything work which may be able to be improved. The first couple of cells need to be run first to set up some variables and tables and the first cell in the database information subsection needs to be run beofre any database cells.

DO NOT try to run all cells (ADS will just crash:-( ) It also will not work when scheduled

I have run both the procedure and the Notebook against a number of versions

image

image

The only "error" was the PowerShell not running elevated

Happy for comments

@SQLDBAWithABeard SQLDBAWithABeard changed the title Generating an Azure SQL Notebook for Best Practice Checks from teh Generating an Azure SQL Notebook for Best Practice Checks from the same script for the stored procedure Dec 4, 2019
@pmasl
Copy link
Contributor

pmasl commented Dec 4, 2019

THANK YOU ROB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants