In this recipe, we first discover the underlying schema for a person object using a quick method (using a JSON object) as described in step 6. The resulting DataFrame will know the schema that we subsequently impose on the streaming input (simulated via streaming a file) and treated as a streaming DataFrame as seen in step 7.
The ability to treat the stream as a DataFrame and act on it using a functional or SQL paradigm is a powerful concept that can be seen in step 8. We then proceed to output the result using writestream() with append mode and a 1-second batch interval trigger.