I have multiple data frames which are extracted from one json messages coming in azure-event-hub. We would like to push these DFs to separate tables in Synapse DW using spark streaming job.
here is my schema -
root
|-- Name: string (nullable = true)
|-- Salary: string (nullable = true)
|-- EmpID: string (nullable = true)
|-- Projects: struct (nullable = true)
| |-- ProjectID: string (nullable = true)
| |-- ProjectName: string (nullable = true)
| |-- Duration: string (nullable = true)
| |-- Location: array (nullable = true)
| | |-- element: struct (containsNull = true)
| | | |-- City: string (nullable = true)
| | | |-- State: string (nullable = true)
| |-- Contact: array (nullable = true)
| | |-- element: struct (containsNull = true)
| | | |-- Phone: string (nullable = true)
| | | |-- email: string (nullable = true)
I have extracted 4 different data frames from above schema -
- Project
- Location
- Contact
- Employee
They all should be inserted in 4 different tables in Synapse
ProjectDf.write.format("spark.sqldw").options(.dbo.Project).save(...)
LocationDf.write.format("spark.sqldw").options(.dbo.Loc).save(...)
ContactDf.write.format("spark.sqldw").options(.dbo.Contact).save(...)
EmployeeDf.write.format("spark.sqldw").options(.dbo.Emp).save(...)
Pls suggest how to apply ForeachBatch sink on this to insert tables.