Doing DevOPs for your Database? You need to start here…

I’ve been doing that thing called DevOPs for about 17 years – you know – before it had a name…

In fact it was when I first joined Jade Software that I realised that Ops and DEV had a common interest in making systems go. In 2002 I started working with our toolset team designing our in-house written toolsets to deploy JADE databases/systems automatically and reliably. Little did I know I would be repeating that methodology around .NET written systems in 2010 and then repeating it again with deploying SQL Server code in 2014…

The major breakthrough for the JADE applications and database was unit testing.

When we started developing in .NET (over a JADE database at the time) it made sense to do unit tests – in fact I don’t know of many good .NET developers who don’t do unit testing.

It was when I started speaking to audiences that I realised that not many people do unit tests for their databases. Why??

Well it appears I was talking to the wrong crowd…. sort of.

Code first developers who design databases using Entity Framework are used to writing unit tests so most times they are testing code that will change the underlying database.

So that led me to ask the question: “Are DBAs doing Unit tests?”


They are not.

Firstly – what is a unit test?

The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect.

This testing is done as part of the development process, and a unit test will check that the code being tested meets a specification, while a library of unit tests together will check the functions expected of the application. By automating the process , which allows the library of unit tests to be run frequently, and repeatedly, it allows us to find bugs earlier, and in smaller units of code, which are far more easier to debug.

Unit tests should be self contained enough that you are isolated in what you are testing so that you know whether have a correctly performing test.  Too often we think of databases as massive stores of data and generally we only test for performance. However – with unit tests we are looking at far smaller sets of data, we want tests that are fast and we are testing the functionality/quality of the code rather than the execution speed.

The upshot is that once we embrace unit testing we can then start to utilise regression testing  which can allow us to refactor our database code just as easily (if not more confidently) as developers do for application code.

So if hiring a .NET developer who doesn’t do unit tests is unthinkable – why would we accept this as the norm for the people who are writing the stored procedures etc that touch/influence and ultimately own our most precious resource – our data…?

Because it is too hard?

I find tuning indexes and queries hard – writing a unit test to prove that my code won’t kill PROD seems way easier. Also if I find a bug in my code when I’m writing the code at 3pm – it’s way easier to fix it then than at 3am when an online banking system has crashed/burned or is now corrupt…. I’m sorry but saying unit testing is too hard is a cop out.

Because it is too slow?

Refer the example above – way easier to write a little bit of a unit test and prove that my change is going to work when it will only trash my DEV instance. Fixing it then is far quicker than when 1,000s of users are affect – because there are less people calling my phone/emailing me when I fix it in my DEV instance..

Because it is too new?

Not at all – SQL Server Data Tools (SSDT) has provided database developers the ability to do unit testing since 2012.

In fact there is an old article at SQLServer Central that is from 2009!!

Because it involves learning a new language?

You don’t have to – tSQLt and SQLTest by Redgate both allow unit tests to be written in TSQL – which most DBAs thrive on. Even SSDT allow you to write unit tests in TSQL.

I have used SSDT a far bit so if you are a database developer then I highly recommend you read “Creating and Running a SQL Server Unit Test”

If you are a DBA then I highly recommend you look at – the official website has lots of useful information. There is a slight learning curve – but after 15 minutes reading and trying it out – it is very simple to use. It allows you to isolate your testing to a particular schema and makes use of fake tables – equivalent of mocking –which allows us to take copy of the table as it is and test against it.

There is a great pluralsight course here:

David Green is the author of the above Pluralsight course and has written a fair bit about tSQLt –

Greg Lucas has also written a lot about tSQLt

His article on  is particularly helpful.

Of course there are some other great utilities and I mentioned one earlier:

SQLTest by Redgate – which is an absolutely awesome tool for DBAs – mainly as it plugs straight into SQL Server Management Studio (SSMS).

It uses the tSQLt framework and incorporates SQLCop SQL Test which will help you enforce best practices for database development and run static analysis tests.

Best part is if you are on a DevOPs for Database journey then you can fold those tests into your Continuous Integration processes to really bring up the quality of your database code. You need to start looking at unit tests – today.







The Data Platform has expanded – so too should our approach in using it….

In recent years we as data professionals have moved from dealing with SQL Server databases with SQL Server Reporting Server and SQL Server Analysis Services interacting with them (all on-premises) to a wide scale data platform.

In fact even the name of most SQL Server things (like my MVP) have morphed into the name of “Data Platform”.

The name allows for new technologies and processes to be folded into the ecosystem. The radical changes brought about by the Azure platform have recently been matched by the breadth of technological choice in how you interact, manage and understand your data.

Let’s look at some key areas of what Microsoft have to offer on the Data Platform:

Database products

SQL Server 2017 – Lets you bring the industry-leading performance and security of SQL Server to the platform of your choice—use it on Windows, Linux, and Docker containers.

SQL Database – Built for developers, SQL Database is a relational database management system with enterprise-class availability, scalability, and security, and built-in intelligence capable of learning app patterns, that can be accessed from anywhere in the world.

Azure Database for MySQL – Quickly stand up a MySQL database and scale on the fly with this fully managed database service for app development and deployment that includes high-availability, security, and recovery at no extra cost.

Azure Database for PostgreSQL – Stand up a PostgreSQL database in minutes and scale on the fly—this fully managed database service for app development and deployment also gives you high-availability, security, and recovery at no extra cost.

SQL Data Warehouse – Scale compute and storage independently with this SQL-based, fully managed, petabyte-scale cloud data warehouse that’s highly elastic and enables you to set up in minutes and scale capacity in seconds.

Azure Cosmos DB – With a guarantee of single-digit-millisecond latencies at the 99th percentile anywhere in the world, this multimodel database service offers turnkey global distribution across any number of Azure regions by transparently scaling and replicating your data to wherever your users are.

Data and analytics products

SQL Server 2017 – With up to 1 million predictions per second using built-in Python and R integration, SQL Server 2017 delivers real-time intelligence as it brings the industry-leading performance and security of SQL Server to the platform of your choice.

HD Insight – A fully managed cloud Spark and Hadoop service, HDInsight provides open source analytic clusters for Spark, Hive, MapReduce, HBase, Storm, Kafka, and Microsoft R Server backed by a 99.9% SLA.

Machine Learning – Easily build, deploy, and manage predictive analytics solutions with this fully managed cloud service and deploy your model into production as a web service in minutes that can be called from any device, anywhere.

Stream Analytics – Develop and run massively parallel real-time analytics on multiple streams of data with this analytics service that helps uncover real-time insights from devices, sensors, infrastructure, and applications.

Azure Bot Service – Accelerate bot development with this intelligent, serverless bot service that scales on demand, requires no server management or patching, and provides built-in templates.

Data Lake Analytics – Develop and run massively parallel data transformation and processing programs in U-SQL, R, Python, and Microsoft .NET over petabytes of data with this on-demand service that provides a simple, scalable way to analyze big data—in seconds.

Data Lake Store – Built to the open HDFS standard, this is a no-limits cloud data lake for your enterprise’s unstructured, semi-structured, and structured data that’s massively scalable and secured, and allows you to run massively parallel analytics.

Data Catalog – Spend less time looking for data and more time getting value from it with this fully managed cloud service that lets you register, enrich, discover, understand, and consume your enterprise data sources.

The current state of the Data Platform is exciting, innovative and vast.  For years my aim was to understand how best I could tune, manage and deploy on SQL Server. The good news is that with “recent” improvements to the SQL Server engine:

we can now all focus on other aspects of the Data Platform…. (sorry but I had to put that in there).

With recent enhancements to the SQL Server engine and the maturity of running databases in Azure – it does mean our roles as data professionals are evolving.

Hard core DBAs are now finding themselves talking to Data Scientists on what is required for a stable, reliable, clean, tested, backed-up and secure data processing strategy.

The ability to deploy to the cloud calls for secure and efficient processes around those deployments and nowadays DBAs are also finding themselves involved in conversations around getting database code into source control, code being tested as part of continuous integration and changes deployed via continuous delivery processes.

Or god forbid – knowing being part of something called agile….!!

The data platform has expanded and grown, our approach in how we manage and deploy to it needs to grow as well.

The good thing is that Microsoft have put a massive amount of effort into – I used to despair with MSDN and Technet documentation – but I am loving and inspired with the quality of articles being put out on 

These days if I’m interacting with a new feature or need to diagnose something being able to quickly use these docs has been fantastic in helping me cope with the new world of an expansive Data platform.


If your Surface Book loses it’s keyboard and trackpad – try removing KB4074588 update

My Surface Book (gen 1) recently did updates and then a day or so later the keyboard and trackpad mysteriously stopped working. Then I heard of 3 other people who experienced the same issue within 24 hours.

I could use the Surface Book in tablet mode – but I tired of that pretty quickly.

The weird things was I could hit the Fn key and it would light up – but could not use the keyboard at all.

Some of the people affected by this issue did system restores which worked. I tried many system restores – which gave me my keyboard and trackpad back BUT the Surface Book repeatedly bluescreened….


Surface Support was contacted – I’d like to say they were helpful. But I wouldn’t be writing this blog post if they completely solved my issue. They sent me here:

Which did nothing.


BTW if people in support think it’s acceptable to leave a person waiting 60 hours before re-contacting them — maybe support isn’t the job for you.

(I used to be Second Level Support Manager so I know how vital it is to update/engage with people who are experiencing issues with software….)

I stumbled across the fact that windows update KB4074588 was installed when I had the updates install – so I removed it. As my next move was a factory reset — so I had nothing to lose.

Restarted and boom I have a keyboard and trackpad and 3 minutes later wrote this to hopefully help others.

I emailed Surface Support to let them know too.