Dictionary Unpacking in Python

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified
Search for a command to run...

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified
No comments yet. Be the first to comment.
Concise guides to Python features and patterns most useful for data engineering — from built-ins to standard library modules.
The buzz is real! Excel now integrates with Python, and it's making waves. I've started my Analytics path with Excel. I plan trips and manage my finances with it. At work, to this day, I'm falling back to it when other tools fail, so I welcome this u...
Here's a useful Dataform concept: pre_operations and post_operations. As the name implies, these represent a set of actions that run before and after the main operation (table, view, or SQL operations

BigQuery has always been a SQL engine for tabular data. Object tables add an interesting twist to that. Instead of rows containing values, an object table gives you one row per file — pointing at da

Query your data lake with warehouse-grade security and performance — without moving a single file.

Ever run a heavy BigQuery SQL query, processed gigabytes of data — and then accidentally closed the tab or forgot to save the results? 😬 Don't re-run it. Your results are still there. BigQuery automa

You can use query parameters in BigQuery hashtag#SQL (now in the console as well!) — but how are they different from variables, and when should you use each? Both parameters and variables act as place

One of the most versatile aspects of Python dictionaries is the ability to unpack them. Ever wondered how to use dictionary values as function arguments?
Simply employ the ** operator**:
def greet(name, age):
return f"Hello {name}, you're {age} years old!"
data = {'name': 'Jane', 'age': 28}
print(greet(**data)) # This will print: Hello Jane, you're 28 years old!
Let's dive deeper into a practical use case:
Imagine making multiple API calls, where every call has a different template with a unique URL, endpoint, and parameters.
You'd need a systematic way to manage this. Here's when dictionary unpacking comes to the rescue.
We're separating the templates and configuration and then leveraging dictionary unpacking for a flexible yet clean approach.
Stay tuned for more Python insights and best practices!
Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.
Enjoyed this? Here are some related articles you might find useful: