Skip to main content
PYSPARK โ€ข LESSON 178

Starting Streaming Queries with writeStream

How do we start a streaming execution query outputting micro-batches to the console sink for debugging?

Productionโฑ 2 Minutesโญ 1120 XP
๐Ÿค” THE QUESTION

How do we start a streaming execution query outputting micro-batches to the console sink for debugging?

๐Ÿ’ก WHAT IS IT?

df.writeStream.format('console').start() kicks off background micro-batch processing to the console sink.

๐ŸŽฏ WHAT IS IT USED FOR?

Local stream testing, inspecting real-time transformations, and debugging streaming micro-batches.

๐Ÿ’ป EXAMPLE
query = streaming_df.writeStream \
    .format("console") \
    .start()

๐ŸŽฏ Mission Objectives

Practice typing production-grade PySpark code for Starting Streaming Queries with writeStream.

  • โœ“ Use writeStream writer API
  • โœ“ Configure console streaming sink
  • โœ“ Start background streaming execution