I am processing some raw files using PySpark and returning results in a list so something like this
def myfunction(lines):
splitlines = lines.split(",")
firstvalue = splitlines[0]
secondvalue = splitlines[1]
return firstvalue, secondvalue
sqlContext = SQLContext(sc)
listoflines = sc.textFile("myfilesdirectory/*").map(myfunction).
I would like to insert firstvalue and secondvalue into a MS SQL table directly in Spark as I retrieved them from Spark. Please note that I am doing many other things in my "myfucntion" and I can not use simple split statement in a lambda function.