Press "Enter" to skip to content

Day: August 13, 2020

Web-Optimized ggplot2 Themes

Petr Baranovskiy shares a few new themes:

This will be a very short post compared to the detailed stuff I usually write. Just what it says on the tin – I made some tweaks to my three favorite {ggplot2} themes – theme_bw(), theme_classic(), and theme_void() – to make the graphics more readable and generally look better when posted online, particularly in blog posts. Please feel free to borrow and use.

Also, I will be frequently using these themes in subsequent posts, and I’d like to be able to point readers here with a hyperlink instead of repeatedly posting the whole theme_web_…() code every time I am writing a post.

Click through for the definition of each theme. H/T R-Bloggers

Comments closed

Methods and Functions in Python

Sairam Uppugundla distinguishes methods from functions in Python:

Function and method both look similar as they perform in an almost similar way, but the key difference is the concept of ‘Class and its Object’. Functions can be called only by its name, as it is defined independently. But methods cannot be called by its name only we need to invoke the class by reference of that class in which it is defined, that is, the method is defined within a class and hence they are dependent on that class.

Read on to see how to create each, as well as more details on types of functions.

Comments closed

Sending an E-Mail with SQL Agent Job Outputs

Thomas Rushton shows how to send an e-mail with the outputs of a SQL Agent job:

I came across a need for SQL Server Agent job output to be emailed out to the developer who created the code that the job was running. For various reasons, they don’t necessarily have access to the SQL Server itself – hurrah – but need to see what’s being generated by their scripts in case something goes wrong.

So, I ended up writing this extremely rough and ready SP

Rough and ready, but it works.

Comments closed

Azure Data Studio August 2020 Release

Alan Yu announces the most recent set of changes around Azure Data Studio:

The notebooks viewlet in Azure Data Studio now includes a dynamic search experience. When you are dealing with hundreds of notebooks, it can be tricky navigating and finding the notebook you need. With this experience, we make it faster to search through notebook content.

Once notebooks are listed in the Notebooks viewlet, users can easily search for content across all notebooks and see how many instances the search term appears in a certain notebook. You can then interact with the notebook.

It’s a notebook-heavy month.

Comments closed

Securing Application Secrets with Azure Key Vault

Rishit Mishra walks us through Azure Key Vault:

As the name suggests, Azure Key Vault is used to store and manage keys securely. Key Vault can be used to store the cryptographic secrets and keys such as authentication keys, storage account keys, data encryption keys, passwords and certificates.

Azure Key Vault enables developers to create the keys for development and testing in minutes, and they can further migrate this setup seamlessly onto the production environment.

The centralized key store/vault can be securely managed by the Key Vault owner who manages permissions to this key store and would be responsible for keeping the secrets secure.

Key Vault becomes quite useful in managing secrets in tools like Azure Databricks and Azure Data Factory without saving a bunch of keys in configuration files. And it’s a lot safer than that option, too.

Comments closed

Hardcoding Calculation Groups in a Measure

Kasper de Jonge works around a limitation with the Power BI UI and calculation groups:

AS we have seen calculation groups are great :). It offers amazing flexibility and is extremely easy to maintain. But sometimes it doesn’t do what you want due the limitations of the visuals. Let’s say I want to have a visual that shows me the sales of current year and sales Previous year on different axis (let’s say as line).

You would create something like the visual below where you want to use the same measure but apply different calc groups for each measure. But unfortunately, below visual is not as we want it to be.

But Kasper has us covered with a bit of DAX, so check that out.

Comments closed

A Trillion-Row Operator

Joe Obbish sets up a challenge:

48 billion rows for a single operator is certainly a large number for most workloads. I ended up completely missing the point and started wondering how quickly a query could process a trillion rows through a single operator. Eventually that led to a SQL performance challenge: what is the fastest that you can get an actual plan with at least one operator processing a trillion rows? The following rules are in play:

1. Start with no user databases
2. Any query can run up to MAXDOP 8
3. Temp tables may be created and populated but all such work needs to finish in 30 seconds or less
4. A RECOMPILE query hint must be present in the final query
5. Undocumented features and behavior are fair game

Read on to see what Joe learned.

Comments closed

Dropping Unused Indexes in Azure SQL DB

Monica Rathbun gives an important lesson around tracking index utilization in Azure SQL Database:

If the index has not shown any utilization I investigate to determine if it is one that can be removed. However, this week something caught my attention. I was looking at a client’s indexes and noted the values for these were not as high as I would have expected. I know that these index statistics are reset upon every SQL Server Service restart, but in this case, I was working on an Azure SQL Database. which got me wondering exactly how that worked. With an Azure Virtual Machine or an on Prem SQL Server instance this is easy to figure out. But with an Azure SQL Database we do not have control over when restarts are done, and what about the Serverless offering (which pauses unutilized databases to reduce costs), how do those behave?  I really want to make sure before I remove any indexes from a database that I am examining the best data possible to make that decision. So, I did some digging.

Read on to see what Monica discovered.

Comments closed