Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2023 11:43 PM
@Anonymous
You have to use writeStream instead of write.
dataDF.writeStream
.option("checkpointLocation", "path-for-checkpoint')
.foreachBatch { (batchDF: Dataset[Row], batchId: Long) =>
batchDF.write
.format("snowflake")
.options(sfOptions)
.save()
}
.foreachBatch { (batchDF: Dataset[Row], batchId: Long) =>
batchDF.write
.format("snowflake")
.options(sfOptions)
.option("dbtable", "demokinesisstream")
.mode(SaveMode.Append).save()
}
It is also recommended to use checkpoint directory to save the streaming metadata which help in restarting the pipeline from the previous point.