Skip to main content
PYSPARK • LESSON 57

Injecting Current Date with current_date()

How do we stamp the current execution date onto all ingested records in an ETL pipeline?

Intermediate2 Minutes300 XP
🤔 THE QUESTION

How do we stamp the current execution date onto all ingested records in an ETL pipeline?

💡 WHAT IS IT?

current_date() returns the current calendar date as a DateType Column evaluated at query execution time.

🎯 WHAT IS IT USED FOR?

Batch ETL partitioning, daily audit stamping, and tracking lakehouse ingestion dates.

💻 EXAMPLE
from pyspark.sql.functions import current_date

df = df.withColumn("ingestion_date", current_date())

🎯 Mission Objectives

Practice typing production-grade PySpark code for Injecting Current Date with current_date().

  • Import current_date function
  • Inject current date Column
  • Stamp batch ETL ingestion date