Press "Enter" to skip to content

Day: November 14, 2022

Sending Messages to Event Hub via Python

Kiril Nikolov has a message for us:

Recently I needed to create an Azure Function app that would connect to an API and send data to an Event Hub as part of a real-time data streaming solution.

Azure functions are the perfect connectivity option for a task like this, allowing you to focus on the trigger and the resulting output message you want to capture in the event stream, while Azure handles the maintenance of the cloud infrastructure and hosting to run it.

Azure functions can be written in multiple languages. I needed to write mine in python, meaning that I had to set up a configuration file to connect to the Event Hub (as I will explain in further detail below).

Click through to see how it all works.

Comments closed

Swapping Integer Digits with R

Tomaz Kastrun shuffles things around:

The problem is described as:

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, 2^31 – 1], then return 0.

For example:

x = 120; reversed_x = 21
x = -2310; reversed_x = -132

Read on to see how you can implement this in R.

Comments closed

AT TIME ZONE Performance and an Alternative

Joe Obbish looks at time zones:

Queries that use the AT TIME ZONE operator may perform worse than desired. For example, Jonathan Kehayias blogged about performance struggles with AT TIME ZONE at sqlskills.com. One key difference between Jonathan’s opinion and my own is that I enjoy writing these kinds of posts.

Read on for the details and check out some work Joe has done around time zone friendly functions as an alternative to AT TIME ZONE.

Comments closed

Azure SQL DB Performance: Business Critical Tier

Reitse Eskens continues the comparison:

My last blog was about the Hyperscale tier, this week we’re back at more regular designs with Business Critical. This design is aimed at performance, local SSD storage and better CPU’s. But that’s not all. Besides this high-speed design, it also has high availability implemented by having a secondary replica ready to take over when the primary fails for any reason. And not just one but three replicas. So, your data should be accessible at all times. To make it even better, you can make one of these replica’s the read-only replica for reporting purposes. I’ve tested most tiers, again I didn’t test the 80 cores SKU because of the price. I also did some testing with and without replica’s but there wasn’t much of a difference. But again, my testing setup is quite simplistic, for your heavier read and write loads it might make a huge difference.

Read on for this and see how it compares to some of the other Azure SQL DB tiers.

Comments closed

Properties of Production-Grade Code

David Wiseman has a list:

Security

Production code needs to be secure, following industry best practices. A security incident can cause severe reputational damage and financial impact.

Maintainability

Production code should be maintainable. Avoiding duplication and striving for simplicity.

Read on for a list of properties which production-grade code should have.

Comments closed

Production Code by Audience

Kenneth Fisher thinks about the audience:

I’ll be honest, all of that is pretty variable. It depends. There are lots of different types of code used in production.

For example, if your code is something you’ll be using yourself, you may not care about how robust it is. I mean you need to make sure it won’t do any harm if it fails, either through restartable steps, rolling back transactions, etc. But if it fails you’re right there to fix whatever went wrong and move on. You can almost think of it as a set of notes on how to do a process. Maintenance is also less of an issue because no one else is likely to be looking at it but you. You still probably want some documentation in case it’s been a while since you used the code and you’ve forgotten how that tricky bit works. And performance? Well, how patient are you? I’m not overly patient so performance is pretty important for code I’m running manually.

Read on for Kenneth’s take but also check out Jeff Moden’s response in the comments for the contrary view.

Comments closed

Schedule a Power BI Dataset Refresh

Gilbert Quevauvilliers keeps to the schedule:

Below are the steps on how to use Power Automate to schedule a refresh of a Power BI dataset at the time you want it to.

I have recently seen some questions in the Power BI Community with regards to refreshing Power BI datasets. I thought it would be a good idea to blog on how to use Power Automate (Flow) to schedule a refresh of a Power BI Dataset.

Read on to see what the limitation is in Power BI and how you can use Power Automate to get around it.

Comments closed