Last active
November 7, 2021 15:40
-
-
Save alonisser/8993c51f6930e2cb4e614720af6e45b4 to your computer and use it in GitHub Desktop.
Code for medium post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the read stream | |
dataitemsAppendDf = spark.readStream.format("delta")\ | |
.option("maxFilesPerTrigger", 25)\ | |
.table(f"{database_name}.{table_name}") | |
# Initiate the write stream | |
dataitemsAppendDf.writeStream \ | |
.trigger(processingTime='15 seconds') \ # note, you can also have different modes here | |
.option("checkpointLocation", f"{checkpoint_name}") \ | |
.foreachBatch(processRawStreamBatch) \ #Callback that would handle each batch | |
.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment