Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Course
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
Newsletter Archive
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

PySpark – Write Reusable SQL Queries Without Hardcoding Values

PySpark – Write Reusable SQL Queries Without Hardcoding Values

Grab your coffee. Here are this week’s highlights.


📅 Today’s Picks

Git Revert vs Reset – Choose the Right Undo Method

Code example: Git Revert vs Reset - Choose the Right Undo Method

Problem

Have you made a commit mistake? Every data scientist faces this situation, but choosing the wrong recovery method can create bigger problems than the original error. The key is understanding when to use git revert versus git reset.

Solution

The decision depends on one critical question: “Has this commit been shared?”

If YES, use git revert which adds new commits that reverse previous changes while preserving history for audit trails.

If NO, use git reset which removes commits entirely and rewrites the timeline for clean, readable history.

Both are powerful tools when used correctly.


PySpark – Write Reusable SQL Queries Without Hardcoding Values

Code example: PySpark - Write Reusable SQL Queries Without Hardcoding Values

Problem

Hardcoding values into PySpark SQL queries leads to messy, repetitive code that’s hard to maintain.

Solution

Instead, define parameterized SQL templates in Apache Spark. These templates let you insert dynamic variables into your queries, making them reusable, testable, and easier to manage across your codebase.


Stay Current with CodeCut

Actionable Python tips, curated for busy data pros. Skim in under 2 minutes, three times a week.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran