Press "Enter" to skip to content

Curated SQL Posts

Packaging and Publishing Python Packages via Poetry

Osheen MacOscar forces me into alliteration:

So far, in the previous blog we covered creating our package with Poetry, managing our development environment and adding a function. In the current blog post we’ll be covering the next steps with package development including documentation, testing and how to publish to PyPI.

Read on for several tips on making Python code package-ready and then how to distribute it via PyPi.

Leave a Comment

Merging the Measures of Two Power BI Semantic Models

Jon Vöge declares a hostile takeover:

Now, how you best maintain multiple copies/variants of the same Semantic Model is a whole other discussion but as a one-off, I was asked to merge the Measures of the two models.

Initially, the question actually stumped me as my usual tool of choice for external manipulation of semantic models Tabular Editor does not have a great native way to solve this. 

Jon lists a variety of options and then gets the job done with ALM Toolkit.

Leave a Comment

PostgreSQL Synchronous Replication is Asynchronous

Jeremy Schneider doesn’t wait for a response:

Postgres database-level “synchronous replication” does not actually mean the replication is synchronous. It’s a bit of a lie really. The replication is actually – always – asynchronous. What it actually means is “when the client issues a COMMIT then pause until we know the transaction is replicated.” In fact the primary writer database doesn’t need to wait for the replicas to catch up UNTIL the client issues a COMMIT …and even then it’s only a single individual connection which waits. This has many interesting properties.

Click through for the pros and cons of this technical decision.

Leave a Comment

Common ORM Tuning Tips

Amy Abel shares some advice:

Recently, I thought a database query in a plan was straightforward. It looked innocent until I noticed strange behavior. The deeper I dug, the more I realized many people might be running into the same issue with ORM queries.

Click through for a toy version of the scenario, as well as two common problems with ORM tuning: blind index acceptance (which, admittedly, is a problem with or without ORMs) and implicit conversion on filters.

Leave a Comment

Using Dygraphs in R

Thomas Williams builds a chart:

I also wanted to get a little interactive with my analysis, and came across Dygraphs for R https://rstudio.github.io/dygraphs/ which wraps the “venerable” (according to creator Dan Vanderkam https://github.com/danvk) javascript charting library of the same name, first released in 2006.

I used Dygraphs in an R script file (it can work equally well in R Markdown) to quickly chart my time series data, loaded from the CSV file. Dygraphs were simple to use, are a solid pick among other charting libraries and very functional for being free and open source.

Read on for a few examples of charts, as well as the entirety of Thomas’s code.

Leave a Comment

Star Schemas and Keys

Chris Barber provides a primer on the types of keys that are critical for a star schema:

Keys are a core component of star schema modelling; relationships between tables are built using the keys. This article covers:

  1. The main key types
  2. Star Schema diagrams
  3. Best practices when using Keys

An understanding of keys become increasingly important with more complex solutions. Not only do you need to understand them from a modelling perspective, but a common vernacular is required to communicate with team members.

It’s easier to think of the keys Chris describes in two separate classes rather than four unique items. Surrogate and natural keys are descriptors of a primary key (or any other unique/alternate key), after all.

Leave a Comment

Decimal Precision and Rounding in SQL Server

Jiri D. provides a warning:

Do you ever worry about how you declare NUMERIC or DECIMAL data types in SQL?
Do you sometimes “add a bit more” precision—just to be safe?
Have you considered how that small decision could actually change your arithmetic results?

I ran into this recently when comparing data between two environments that should have produced identical results. One calculated field was slightly off — and the culprit turned out to be a difference in numeric data type declarations.

Read on to see what happened. The differences weren’t massive, but if you were expecting an exact match, seeing a difference, even at the 7th or 8th spot after the decimal, could be jarring.

Leave a Comment

Installing SQL Server 2025 Standard Developer Edition on Linux

Rajendra Gupta tries out a new edition available in SQL Server 2025:

In the article “Install SQL Server 2025 Standard Developer Edition,” we explored the installation of SQL Server 2025 Standard Developer Edition on the Windows platform. SQL Server 2025 (Preview) also works on Linux editions, and it is equally important to cover the installation steps. Let’s see how we can install it on an AWS EC2 instance running Ubuntu.

The first half of the article covers spinning up an EC2 instance. Interestingly, the prompt to choose your edition of SQL Server was only partially updated—it still asks for you to choose an option between 1 and 10, but there are now 11 options available and I’m now curious if the conditional logic in the script to choose your edition works if you want to use Enterprise Core. Rajendra does note an error message that pops up around licensing, but that could be a release candidate thing.

Leave a Comment