Skip to main content
PYSPARK • LESSON 273

Streaming Output Modes: Append vs Complete vs Update

How can we select the correct output mode for streaming stateful aggregations vs simple row transformations?

Production3 Minutes820 XP
🤔 THE QUESTION

How can we select the correct output mode for streaming stateful aggregations vs simple row transformations?

💡 WHAT IS IT?

outputMode('append') outputs new rows; 'complete' outputs the entire aggregated result table; 'update' outputs only modified rows.

🎯 WHAT IS IT USED FOR?

Writing incremental event feeds ('append') vs publishing live KPI counter dashboards ('update' or 'complete').

💻 EXAMPLE
query_update = streaming_counts.writeStream.outputMode("update").format("console").option("checkpointLocation", "/tmp/checkpoints/update/").start()

🎯 Mission Objectives

Practice typing production-grade PySpark code for Streaming Output Modes: Append vs Complete vs Update.

  • outputMode selection
  • Append vs Update vs Complete
  • Streaming sink behavior