Skip to content
GoldNEW 6 min read 2 practice problems ↓

Python Data Source API

Write custom batch and streaming readers and writers for Spark in pure Python.

Step 2 · Spark internals · Gold · Spark 4, lesson 5 of 5

Read first: Partitions · Spark Connect (skip if you know them)

In plain words first

Spark has adapters for the common plugs: ParquetParquet: A columnar file format: values of each column are stored together, so queries read only the columns they need. Learn more →, CSV, JDBC. For an unusual socket, you used to need an electrician who spoke Scala. The Python Data Source API lets you make the adapter yourself, in Python.

Unlock the full lesson

You have read the free part. The rest of this advanced lesson:

  • Why it exists
  • A batch reader, step by step
  • Writers
  • Streaming
  • Practical advice
  • Try it yourself
  • Common mistakes
  • Key takeaways
  • Interview prep with 3 follow-up questions
  • Check yourself: 3 questions

Unlock it with the Complete pass (every advanced problem and lesson) or on its own.

Practise this

Interview problems on spark performance, graded on hidden tests

Keep going

Last lesson of Spark internals
Back to the journey →

Related lessons

Previous: SQL pipe syntax

Primary sources: Python Data Source API